-
Notifications
You must be signed in to change notification settings - Fork 1
Add HTTP cache headers for static files #63
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
Conversation
…upport Co-authored-by: L3P3 <4629449+L3P3@users.noreply.github.com>
|
@copilot Is there even a value in using etag here? Is it redundant? If the if-modified-since is serving the same function already, remove the etag stuff again. I am not sure. |
Co-authored-by: L3P3 <4629449+L3P3@users.noreply.github.com>
You're correct - the ETag was redundant since it was just encoding the same mtime + size that Last-Modified already provides. I've removed the ETag implementation and simplified to use only Last-Modified/If-Modified-Since, which is sufficient for static file caching. (8537cd2) |
L3P3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the changes shorter please.
Inline the mtime_ms and last_modified variable.
Set the two response headers where above variables were defined.
Instead of throw 304, set the status, call end and return directly and leave the catch block as it is.
…f throw Co-authored-by: L3P3 <4629449+L3P3@users.noreply.github.com>
Done. Inlined variables, set headers immediately, and used |
Implementation Plan for HTTP Cache Headers
Summary
Simplified implementation to use only Last-Modified/If-Modified-Since for HTTP caching:
Features:
Code simplifications:
mtime_msandlast_modifiedvariablesresponse.statusCode = 304; response.end(); return;instead ofthrow 304Testing:
Security Summary:
No security vulnerabilities detected by CodeQL analysis.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.