summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-01-28 19:00:17 +0200
committerPaul Buetow <paul@buetow.org>2026-01-28 19:00:17 +0200
commit04fd17c7f7f6c489238cccc2b34f3f2b42a12c62 (patch)
tree558765d2219384baa09e07ef4fa4268781a9c577 /frontends
parent755ede6cdae8570037a7cf59218f2baebbcdd631 (diff)
Add cache-control headers to f3s fallback page
- Add meta tags to prevent browser caching of fallback page - Add response header directives in relayd to set Cache-Control headers - Prevents cached fallback page from being served when cluster comes back online Amp-Thread-ID: https://ampcode.com/threads/T-019c0589-2021-71cc-a2ba-2cd942f4fdef Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'frontends')
-rw-r--r--frontends/etc/relayd.conf.tpl9
-rw-r--r--frontends/var/www/htdocs/f3s_fallback/index.html3
2 files changed, 10 insertions, 2 deletions
diff --git a/frontends/etc/relayd.conf.tpl b/frontends/etc/relayd.conf.tpl
index 0a7283f..88467bd 100644
--- a/frontends/etc/relayd.conf.tpl
+++ b/frontends/etc/relayd.conf.tpl
@@ -56,11 +56,16 @@ http protocol "https" {
# For f3s hosts: use relay-level failover (f3s -> localhost backup)
# Registry is special: needs explicit routing to port 30001
<% for my $host (@$f3s_hosts) { for my $prefix (@prefixes) {
- if ($host eq 'registry.f3s.buetow.org') { -%>
+ if ($host eq 'registry.f3s.buetow.org') { -%>
match request header "Host" value "<%= $prefix.$host -%>" forward to <f3s_registry>
<% }
} } -%>
-}
+
+ # Add cache-control headers to f3s fallback pages (served from localhost when cluster is down)
+ match response header set "Cache-Control" value "no-cache, no-store, must-revalidate"
+ match response header set "Pragma" value "no-cache"
+ match response header set "Expires" value "0"
+ }
relay "https4" {
listen on <%= $vio0_ip %> port 443 tls
diff --git a/frontends/var/www/htdocs/f3s_fallback/index.html b/frontends/var/www/htdocs/f3s_fallback/index.html
index a84151a..c872241 100644
--- a/frontends/var/www/htdocs/f3s_fallback/index.html
+++ b/frontends/var/www/htdocs/f3s_fallback/index.html
@@ -2,6 +2,9 @@
<html>
<head>
<title>Server turned off</title>
+ <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+ <meta http-equiv="Pragma" content="no-cache" />
+ <meta http-equiv="Expires" content="0" />
<style>
body {
font-family: sans-serif;