I made a react app with a Django Rest Framework backend, using Mac OS X with Chrome. When I refresh the app a few times, the app stops making the API call and starts to use cached data, even though I have no-cache
and max-age
headers. Interestingly, if the developer tools window is open, it always makes the API call and doesn't use the cached data. Is there a way to force the app to always make the API call, regardless of whether dev tools is open or not?
I've done quite a few things to trouble shoot this. I've added a query parameter that has seconds in it like this SO link says to do.
I've also added Profiling on DRF mentioned here.
What is weird that I don't see logs on the Django side after some API calls which means to me that Chrome is caching something.
I don't see this behaviour in Safari.
I also created a simple JQuery App and see this behaviour there, so I don't think its a React/Fetch problem.
Its really inconsistent, so its been very hard to troubleshoot.
EDIT
Here is my header showing cache control and I am still experiencing this:
HTTP/1.1 200 OK
Server: gunicorn/19.3.0
Date: Wed, 09 Nov 2016 16:39:07 GMT
Connection: close
Transfer-Encoding: chunked
Expires: Wed, 09 Nov 2016 16:39:07 GMT
Last-Modified: Wed, 09 Nov 2016 16:39:07 GMT
Allow: GET, POST, HEAD, OPTIONS
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Access-Control-Allow-Origin: *
Content-Type: application/json
Request Headers
view source