Reputation: 9449
I'm encountering a challenge where converting my site to using https is creating problems with cache manifest. I get an error in chrome as follows: Application Cache Error event: Manifest fetch failed(4) http://www.bibletools.info/cache.manifest
In Safari I get a redirect loop error.
This is the htaccess code I'm using to redirect it:
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
This is what my cache manifest looks like:
CACHE MANIFEST
# February 18, 2016 v1
CACHE:
/
/assets/app.min.css?v=1.4
https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic
https://fonts.googleapis.com/css?family=Raleway:400,300,700
https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js
https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css
/assets/app.min.js?v=1.3
NETWORK:
*
HTTP://*
I understand that clearing the browser cache typically seems to solve the issue, but my users are not aware of that solution. What can I do to transition them to the secure server?
Upvotes: 0
Views: 1016
Reputation: 36
Two options;
Change the name of your manifest file (call it manifest.appcache, or something). That way, your old cached pages will receive a 404 error when they try to access the cache.manifest file. The 404 means the browser will delete the cache completely (as per here), and start again; http://www.html5rocks.com/en/tutorials/appcache/beginner/
Change your rewrite rule to the below;
RewriteRule ^((?!cache\.manifest).)*$ https://%{SERVER_NAME}/$1 [R,L]
This will allow HTTP traffic to your manifest so that old caches can update themselves.
You need to also make a small change to your manifest file, so the old caches download the new version of all of the files. This can just be adding a comment or incrementing your version number in your manifest.
You would use option 1 if you don't care about what people have cached currently and just want to start again on HTTPS. You would use option 2 if you don't want to have to change the name of the cache and don't want your users to have to re-download all of the cache files.
Upvotes: 2