gadicc / meteor-headers

Access HTTP headers on both server and client. Client IP with proxy support.
https://atmospherejs.com/gadicohen/headers
GNU Lesser General Public License v3.0
61 stars 21 forks source link

Fail on refresh after server reload when using appcache on Chrome #11

Closed gadicc closed 10 years ago

gadicc commented 10 years ago

To reproduce:

  1. Load page in Chrome
  2. Reload the server
  3. Reload the page (ctrl-R)

Headers will now not be available on the server.

This is because the client sends the old token, which no longer exists on the reloaded server process.

Workarounds:

  1. Disable appcache
  2. Only use header.methodGet()

Required fix:

  1. Make a new request for headers (ala our old method) when loading from the appcache and not the server. But I can't seem to figure out how to tell where the script is loaded from. onnoupdate fires too late to be useful.

Other notes:

  1. Firefox seems to be unaffected since on a page reload, it refreshes the appcache manifest.
gadicc commented 10 years ago

Happy to say this is fixed in 0.0.16 with commit https://github.com/gadicohen/meteor-headers/commit/a655ef825cc14238f3811f666fff46740bdeb7b1.

If appcache is enabled, headers are sent using the old method (which unfortunately requires an extra round-trip to the server, but you're not loading the initial page anymore (which comes from the cache), so I think that's more than fair :)).