0

I add a no-cache header in the response to ensure the browser will only make use of the copy if the response is different.

But, all requests hit the MVC action and same response is sent back to the browser. However, I expect a 304 status will be sent back if the response is the same.

The response headers:

enter image description here

The request headers:

enter image description here

Charlie
  • 1,520
  • 1
  • 12
  • 25
  • You don't seem to be returning a validation header (i.e. `Last-Modified` or `ETag`). Without it, there's no way for the server to validate cached content. – Kevin Christopher Henry May 21 '20 at 05:41
  • @KevinChristopherHenry dose it mean to make use of the ```no-cache``` header, we must provide with ```Last-Modified``` or ```ETag``` together? if so, why bother ```no-cache```, I think we can just use ```Last-Modified``` or ```ETag``` without ```no-cache```. – Charlie May 21 '20 at 10:49
  • I think you're confused about the difference between caching and revalidation. You said you expected a `304`, which is a revalidation status code that requires either last modified or etag. – Kevin Christopher Henry May 21 '20 at 11:24
  • @KevinChristopherHenry Yes... I DO confuse about them. But if not 304 what else should I expect if there's a no-cache header, and the server dose return the same response. – Charlie May 21 '20 at 14:31

0 Answers0