question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ResponseCaching returns no headers in 304 NotModified response

See original GitHub issue

Describe the bug

ResponseCaching returns no headers in 304 NotModified response

To Reproduce

Steps to reproduce the behavior:

  1. Setup a server that uses ResponseCaching
  2. Make a request that responds with a Last-Modified and Expires header and see that it gets put into the ResponseCache
  3. The Response will be a 200 with headers including Last-Modified, Expires, Cache-Control
  4. Make the same request again, but add the If-Modified-Since header with a value the same as the previously returned Last-Modified time
  5. 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:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alefranzcommented, Jun 16, 2019

I will give it a go

0reactions
analogrelaycommented, Jul 27, 2019

Indeed! Unfortunately “Addresses” doesn’t close the issue out when the PR is closed 😃.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found