I'm trying to get my header rounder Caching. I have the following code in vb.net:
With HttpContext.Current.Response
.Cache.SetCacheability(HttpCacheability.Public)
.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches)
.Cache.SetLastModified(Now)
.Cache.SetExpires(DateTime.UtcNow.AddSeconds(120))
.Cache.SetMaxAge(TimeSpan.FromSeconds(120))
End With
Which returns the following headers:
Cache-Control: public, no-cache="Set-Cookie", must-revalidate, max-age=120
Content-Type: application/xml; charset=utf-8
Expires: Mon, 22 Aug 2016 13:54:36 GMT
Last-Modified: Mon, 22 Aug 2016 13:52:36 GMT
But I'm trying to figure out what is setting no-cache="Set-Cookie"
and how can I switch that on or off?
Cache-control: no-cache This is useful to ensure that authentication is respected among other benefits. The no-cache directive uses the ETag header field for validation of the cached response by making a roundtrip to and from the server to ensure that the response has not changed.
no-cache. The no-cache response directive indicates that the response can be stored in caches, but the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server.
The Set-Cookie HTTP response header is used to send a cookie from the server to the user agent, so that the user agent can send it back to the server later. To send multiple cookies, multiple Set-Cookie headers should be sent in the same response.
The no-cache directive means that a browser may cache a response, but must first submit a validation request to an origin server.
The no-cache="Set-Cookie" tells the browser not to cache the server "Set-Cookie" header, but follow different rules for the rest of the request. Here's a discussion from W3C http://www.w3.org/Protocols/HTTP/Issues/cache-private.html
In http 1.1, Roy has proposed some features for the new cache-control directive that allow servers to selectively disable caching on specific headers. This would be, for example: cache-control: no-cache="set-cookie"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With