Incoming "last-modified" requests
See original GitHub issue- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since
Clients, upon receiving resources with a Last-Modified
header, may send requests that contain one or both of the above linked headers. I think handling these headers would be outside the scope of this plugin. At best, I think the incoming request object could be decorated with the values of these headers, e.g.:
fastify.decorateRequest('ifModifiedSince', function () {
if (!this.req.headers['if-modified-size']) return null
return new Date(this.req.headers['if-modified-since'])
})
Do you agree @fastify?
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
Incoming HTTP Requests | dotTrace Documentation - JetBrains
The Incoming HTTP Requests: Method sub-filter shows distribution of Incoming HTTP Requests time between requests with particular methods.
Read more >Last-Modified - HTTP - MDN Web Docs - Mozilla
The Last-Modified response HTTP header contains a date and time when the origin server believes the resource was last modified.
Read more >Request and response behavior for custom origins
Caching. Ensure that the origin server sets valid and accurate values for the Date and Last-Modified header fields.
Read more >Evaluating request preconditions using Request objects - IBM
You have used the javax.ws.rs.core.Request object to evaluate the HTTP headers of an incoming request, and determine the proper response to the request....
Read more >HTTP/1.1: Header Field Definitions
The Accept request-header field can be used to specify certain media types ... instead of a date taken from the Last-Modified header for...
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
Express / Koa use the
fresh
module for this logic, if that helps at all.I have opted to ignore the
Last-modified
mechanism and only support theETag
mechanism. The ETag standard has been around long enough that web browsers should support it. If the desire it to give the clients a hint to not issue a request to the server, then theExpires
header can be sent along with theETag
header.