Mor info on the WebServer::serveStatic method please #11728
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm running a websever on an esp32s3 and using the server.serveStatic method to deliver images to the requesting browser.
ex:
server.serveStatic("/water_press_warn", LittleFS, "/water_press_warn_v2.png");
I'm trying to implement a caching control header so that the image doesnt need to reload everytime a user logs onto the server.
For example: Cache-Control: max-age=31536000, immutable
In researching the webserver library, there seems to be an additional argument available in the serverStatic method to allow for this:
void serveStatic(const char *uri, fs::FS &fs, const char *path, const char *cache_header = NULL);
I've tried to implement without success as I'm unsure that I'm using the correct syntax.
ex:
server.serveStatic("/water_press_low", LittleFS, "/water_press_low_v2.png", "max-age = 315360000");
Would appreciate some guidance on the exact syntax I need to use for this to work as I cant find it in the documentation or the example files...
Thanks in advance for any help...
@me-no-dev, as you are very knowlegeable with this library, if you can spare 30 seconds to respond it would really be appreciated...
Beta Was this translation helpful? Give feedback.
All reactions