I have a http request /api/speakers/
and I want it to be cached by browser.
So I added Cache-Control
to the request headers:
headers: {
'Cache-Control': 'public, must-revalidate, max-age=86400'
}
cache-control
appears in request headers, but every time it requests it gets new data from response. I am testing without refreshing page, so that is not the problem.
What am I doing wrong? How to tell browser to cache request responses and not to request it next one day.
I thought that Cache-control
should be sent by frontend, so the browser understands it and caches requests. It turned out that backend sends headers in response so browser can cache requests. In my case, backend written in Django
used cache_page
and now browser caches everything perfectly.