I have set all headers that I know of to disable caching (even disabling ETAG) on my server, yet Safari still occasionally (about 50% times) caches my requests.
I am implementing oauth 1, so:
Browser makes GET /api/user
request
Server returns 405
Browser redirects to 3rd party website to authenticate
Browser is redirected to api/callback
which stores some info into cookie.
Browser is redirected back to original route.
Browser makes GET /api/user
request which should be successful, however it gets 405 served from disk cache instead.
URL: http://localhost:3000/api/user
Status: 405 Method Not Allowed
Source: Disk Cache
No request, served from the disk cache.
Transfer-Encoding: Identity
Content-Type: application/json; charset=utf-8
Pragma: no-cache
Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0
Vary: Cookie, Accept-Encoding
Date: Wed, 23 Jan 2019 11:34:23 GMT
Content-Encoding: gzip
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Connection: close
x-powered-by: Express
I have no idea what's wrong and I will greatly appreciate any help. My Safari version is 12.0.2
. I wasn't able to replicate this issue with Chrome.
Use Vary: *
. This magically solved my problem.
This answer helped me: https://stackoverflow.com/a/2068353/1364158
Alternatively, you can really force browser to load a new version of request by including some meaningless random query arg in your url, e.g. /api/user?ts=18284
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments