Skip to content

Commit

Permalink
Updated ttl on web resources
Browse files Browse the repository at this point in the history
  • Loading branch information
gskjold committed Sep 13, 2023
1 parent a355131 commit ecea497
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/SvelteUi/include/AmsWebHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ static const char HEADER_LOCATION[] PROGMEM = "Location";
static const char CACHE_CONTROL_NO_CACHE[] PROGMEM = "no-cache, no-store, must-revalidate";
static const char CONTENT_ENCODING_GZIP[] PROGMEM = "gzip";
static const char CACHE_1HR[] PROGMEM = "public, max-age=3600";
static const char CACHE_1MO[] PROGMEM = "public, max-age=2592000";
static const char CACHE_1MO[] PROGMEM = "public, max-age=2630000";
static const char CACHE_1YR[] PROGMEM = "public, max-age=31536000";
static const char PRAGMA_NO_CACHE[] PROGMEM = "no-cache";
static const char EXPIRES_OFF[] PROGMEM = "-1";
static const char AUTHENTICATE_BASIC[] PROGMEM = "Basic realm=\"Secure Area\"";
Expand Down
8 changes: 4 additions & 4 deletions lib/SvelteUi/src/AmsWebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ void AmsWebServer::notFound() {
void AmsWebServer::githubSvg() {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Serving /github.svg over http...\n"));

server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1HR);
server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1MO);
server.send_P(200, "image/svg+xml", GITHUB_SVG);
}

void AmsWebServer::faviconSvg() {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Serving /favicon.ico over http...\n"));

server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1HR);
server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1MO);
server.send_P(200, "image/svg+xml", FAVICON_SVG);
}

Expand Down Expand Up @@ -768,7 +768,7 @@ void AmsWebServer::indexCss() {
if(!checkSecurity(2))
return;

server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1MO);
server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1YR);
server.sendHeader(HEADER_CONTENT_ENCODING, CONTENT_ENCODING_GZIP);
server.send_P(200, MIME_CSS, INDEX_CSS, INDEX_CSS_LEN);
}
Expand All @@ -779,7 +779,7 @@ void AmsWebServer::indexJs() {
if(!checkSecurity(2))
return;

server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1MO);
server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1YR);
server.sendHeader(HEADER_CONTENT_ENCODING, CONTENT_ENCODING_GZIP);
server.send_P(200, MIME_JS, INDEX_JS, INDEX_JS_LEN);
}
Expand Down

0 comments on commit ecea497

Please sign in to comment.