I am fetching a resource from my RESTful web service, and in the response I add these two headers:
Cache-Control: public, max-age=120 ETag: "3D03F8066015A1438532E049AE5E16EA" The first time the browser got this response it cached it correctly for 2 minutes.
However, the next time I requested the resource, my browser now sent an IfNoneMatch header, and got a 304 Not Modified as expected, along with another Cache-Control header to cache for 2 minutes.
BUT the browser did not cache the response. I keep refreshing the page, and it keeps making the request, and therefore keeps getting 304 Not Modified.
Is this a normal behavior?
How do I tell the browser to revalidate its cached resource for 2 more minutes, after it gets a 304 Not Modified, and to not make any more requests?
ETagof the cached asset in the browser on theIf-None-MatchHTTP request header, then the server checks the token against current assets in the cache. If theEtagandIf-None-Matchheaders match the304 Not Modifiedresponse is sent to the browser. This process ocurrs every 120 seconds based on themax-age.