ResponseCaching returns no headers in 304 NotModified response
See original GitHub issueDescribe the bug
ResponseCaching returns no headers in 304 NotModified response
To Reproduce
Steps to reproduce the behavior:
- Setup a server that uses ResponseCaching
- Make a request that responds with a Last-Modified and Expires header and see that it gets put into the ResponseCache
- The Response will be a 200 with headers including Last-Modified, Expires, Cache-Control
- Make the same request again, but add the If-Modified-Since header with a value the same as the previously returned Last-Modified time
- The Response will be a 304 but it won’t have any headers.
Expected behavior
The 304 response should contain a number of headers as specified in RFC 7232
https://tools.ietf.org/html/rfc7232#section-4.1
The server generating a 304 response MUST generate any of the
following header fields that would have been sent in a 200 (OK)
response to the same request: Cache-Control, Content-Location, Date,
ETag, Expires, and Vary.
Additional context
You can see this quite clearly in https://github.com/aspnet/AspNetCore/blob/master/src/Middleware/ResponseCaching/src/ResponseCachingMiddleware.cs#L156
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
304 Not Modified - HTTP - MDN Web Docs
The HTTP 304 Not Modified client redirection response code indicates that there is no need to retransmit the requested resources.
Read more >How to Fix the HTTP 304 Not Modified Status Code
The 304 (Not Modified) status code indicates that a conditional GET or HEAD request has been received and would have resulted in a...
Read more >net 6 & HTML 304 Not Modified
An HTTP status 304 is a Good Thing: it's just the server's way of telling the browser it's OK to reload the content...
Read more >Sending Content (Message Body) along with 304 Not ...
The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields. Share....
Read more >Response Caching Middleware in ASP.NET Core
HTTP headers used by Response Caching Middleware ; If-Modified-Since, If the If-None-Match header isn't present, a full response is served from ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I will give it a go
Indeed! Unfortunately “Addresses” doesn’t close the issue out when the PR is closed 😃.