4

If I include in my application cache manifest:

/example.html

and this redirects to

https://s3.amazonaws.com/longURL/example.html?dynamicauthenticationparameters

will this work?

The current draft HTML5 specification seems to be silent on redirects for content files (as opposed to the manifest itself) apart from referring to a manual redirect flag, which apparently is set but (as far as I can tell) never actually used.

(The intention is to avoid proxying some S3 content, but to still make it available offline using the cache mechanism. JavaScript and LocalStorage would presumably be a workaround if the above can't be done).

Any pointers to the relevant part of a spec and/or current browser implementation behavior would be helpful.

4

1 回答 1

3

The current specification now states that if the resource is redirected to a different origin, then this is treated as a failure and the local cached copy (or fallback) is used instead.

In section 5.6.4 of http://www.w3.org/TR/2011/WD-html5-20110525/offline.html it states that:

Redirects are fatal because they are either indicative of a network problem (e.g. a captive portal); or would allow resources to be added to the cache under URLs that differ from any URL that the networking model will allow access to, leaving orphan entries; or would allow resources to be stored under URLs different than their true URLs. All of these situations are bad.

So sadly you can't serve some pages from Amazon S3 or Cloudfront.

于 2014-08-27T20:48:47.017 回答