-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
set real "Last-Modified" header based on file's LastWrite time #5
Conversation
Get file's LastWrite timestamp for file handlers (if supported by FS driver) and construct proper "Last-Modified" header. Works fine for LittleFS. If not supported by FS than fallback to previous implementation with manual value for "Last-Modified". an example code to serve static files from LittleFS with IMS revalidation ``` // serve all static files from LittleFS root / server.serveStatic("/", LittleFS, "/") .setDefaultFile("index.html") .setCacheControl("must-revalidate"); // revalidate based on etag/IMS headers ``` Signed-off-by: Emil Muratov <[email protected]>
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.
Just some little change to confirm / update
@vortigont : you are currently using this mod in your app ? Can you confirm it is tested and works fine ? |
yes, I'm using this feature for quite a long time, works perfectly. |
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.
I tested the PR locally more in depth. Here are some more comments.
No need to change the header file and you can simplify the changes in the impl.
Once the changes are done and pr rebased, good to go for me.
Thanks 👍
OK, I've rolled back code to C style and kept as much old code as possible. |
Get file's LastWrite timestamp for file handlers (if supported by FS driver) and construct proper "Last-Modified" header. Works fine for LittleFS. If not supported by FS than fallback to previous implementation with manual value for "Last-Modified".
an example code to serve static files from LittleFS with IMS revalidation