Seeing some odd behaviour in Chrome, and not sure if it's expected behaviour when using appcache, or just Chrome.
It's a single-page app, powered by our RestAPI, it works fine when the RestAPI is being requested under HTTP, however as soon as we change the url to be the HTTPS version then it stops working. There's not a lot (i.e. any) information in Chrome's console as to why it decides to stop working.
We've managed to narrow it down to the NETWORK
section in the appcache file, the only way we can get it to work is to use the *
wildcard, which we don't want to do, as that bypasses the whole point of the appcache, and reduces security (from my understanding from reading the docs etc).
We've tried any and all variations of the API url (as in combinations of it with wildcards in various relevant locations), but none seem to work (even a https://*
doesn't allow a successful request).
Any experienced know what's going on at all?
Thanks
Need a bit of clarification (see my comment), but in the meantime:
The NETWORK
behaviour of the manifest is really there to, according to the spec, make "the testing of offline applications simpler", by reducing the difference between online and offline behaviour. In reality, it just adds another gotcha.
By default, anything that isn't explicitly in the manifest (listed in the manifest file), implicitly part of the cache (a visited page that points to the manifest), or covered by a FALLBACK
prefix, will fail to load, even if you're online, unless the url is listed in the NETWORK
section or the NETWORK
section lists *
.
Wildcards don't have special meaning in the NETWORK
section, if you list http://whatever.com/*
it will allow requests to that url, as an asterisk is a valid character in a url. The only special case is a single *
, which means "allow the page to make network requests for any resources that aren't in the cache".
Basically, using *
in NETWORK
isn't a security risk, in fact it's probably what you want to do, every AppCache site I've built uses it.
I drew this flow chart to try and explain how appcache loads pages and resources:
来源:https://stackoverflow.com/questions/15293684/ssl-path-in-appcache-network-being-restricted-in-chrome