Does ETag invalidate the Cache-Control header?

1.3k views Asked by At

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?

0

There are 0 answers