Web: allow browser caching of static HTML pages
The login, app, and stats HTML pages are static assets compiled into PROGMEM. All dynamic content is fetched separately via JavaScript API calls after the page loads — the HTML itself never changes between requests within the same firmware version. The "Cache-Control: no-store" header forced the browser to re-download the full HTML on every visit, including a complete chunked transfer from the ESP32. Given that the ESP32 is slow and serves responses in small chunks, this was an unnecessary repeated cost that added latency before the page became interactive. Removing no-store allows the browser to cache the HTML pages locally. Subsequent requests are served from the browser cache instantly, with no transfer from the ESP32 at all, leaving the server free to handle the API requests that actually carry dynamic data.
This commit is contained in:
@@ -2682,7 +2682,6 @@ esp_err_t WebPanelServer::handleIndex(httpd_req_t* req) {
|
||||
}
|
||||
ctx->self->noteActivity();
|
||||
httpd_resp_set_type(req, "text/html; charset=utf-8");
|
||||
httpd_resp_set_hdr(req, "Cache-Control", "no-store");
|
||||
return sendProgmemChunked(req, kWebPanelLoginHtml);
|
||||
}
|
||||
|
||||
@@ -2709,7 +2708,6 @@ esp_err_t WebPanelServer::handleApp(httpd_req_t* req) {
|
||||
}
|
||||
ctx->self->noteActivity();
|
||||
httpd_resp_set_type(req, "text/html; charset=utf-8");
|
||||
httpd_resp_set_hdr(req, "Cache-Control", "no-store");
|
||||
return sendProgmemChunked(req, kWebPanelAppHtml);
|
||||
}
|
||||
|
||||
@@ -2720,7 +2718,6 @@ esp_err_t WebPanelServer::handleStatsPage(httpd_req_t* req) {
|
||||
}
|
||||
ctx->self->noteActivity();
|
||||
httpd_resp_set_type(req, "text/html; charset=utf-8");
|
||||
httpd_resp_set_hdr(req, "Cache-Control", "no-store");
|
||||
if (ctx->self->_runner != nullptr && !ctx->self->_runner->isWebStatsEnabled()) {
|
||||
return sendProgmemChunked(req, kWebPanelStatsDisabledHtml);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user