-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't cache a page load (setting "cache-control" with setHeaders
doesn't seem to work)
#7125
Comments
Could this be related to #6477? |
Related, though that issue is primarily about client-side caching. Unfortunately I don't think there's a good way to cache at the CDN/browser HTTP cache level with the current solution. We might need to investigate alternatives. |
@Rich-Harris Do you know what's currently preventing the browser to cache the response? The appropriate headers are sent, but there must be a reason why the browser is ignoring them. |
Yes, it's all explained in #6477 (comment). I've just added |
I don't quite understand the issue - at least I can't reproduce this. When testing this myself I see the cache header being respected. Your response log indicates the same, it says "304 not modified" with the cache-control header set accordingly. From https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304 : "Note: Many developer tools' network panels of browsers create extraneous requests leading to 304 responses, so that access to the local cache is visible to developers." |
Yeah, I think we fixed it a while back but didn't close this issue. Closing now |
Describe the bug
For example, setting the cache here has no effect.
Maybe it's because the initial request to the page contains "Cache-Control: max-age=0"?
So the current behavior is that even if I set the "cache-control" header, the request is always processed by the server (instead of being served by disk/memory cache).
The expected behaviour is that the request is served from cache after being cached (obviously)
Reproduction
Unfortunately, I can't really debug "cache-control" using node.new 🤔 The network panel doesn't give me access to the "sandboxed" requests.
Logs
Raw response headers
Raw request headers
System Info
Severity
serious, but I can work around it
Additional Information
I guess a temporary workaround is to do in-memory caching?
The text was updated successfully, but these errors were encountered: