From 7e58ff1737ed72eef05b107ac0390227bec69b39 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 8 Apr 2026 19:02:59 +0300 Subject: Add offline-page fallback for f3s static relay --- frontends/etc/relayd.conf.tpl | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'frontends/etc') diff --git a/frontends/etc/relayd.conf.tpl b/frontends/etc/relayd.conf.tpl index 6248dee..70fbeab 100644 --- a/frontends/etc/relayd.conf.tpl +++ b/frontends/etc/relayd.conf.tpl @@ -14,6 +14,12 @@ table { 192.168.2.204 } +# Local relayd hop for the static landing page, used to get a real localhost fallback +table { + 127.0.0.1 + ::1 +} + # Same backends, separate table for registry service on port 30001 table { 192.168.2.120 @@ -57,7 +63,6 @@ http protocol "https" { # Enable WebSocket support http websockets - return error match request header set "X-Forwarded-For" value "$REMOTE_ADDR" match request header set "X-Forwarded-Proto" value "https" @@ -83,7 +88,7 @@ http protocol "https" { for my $prefix (@prefixes) { if ($host eq 'f3s.buetow.org') { -%> - match request header "Host" value "<%= $prefix.$host -%>" forward to + match request header "Host" value "<%= $prefix.$host -%>" forward to <% } elsif ($host eq 'registry.f3s.buetow.org') { -%> match request header "Host" value "<%= $prefix.$host -%>" forward to @@ -109,8 +114,8 @@ relay "https4" { session timeout 300 # Primary: f3s cluster (with health checks) - Falls back to localhost when all hosts down forward to port 80 check tcp - # Static landing page served from pi0/pi1 instead of k3s - forward to port 80 check tcp + # Static landing page is routed through a local relay so it can fall back to localhost + forward to port 18080 check tcp forward to port 8080 check http "/" code 200 # Registry uses separate port and table forward to port 30001 check tcp @@ -126,8 +131,8 @@ relay "https6" { session timeout 300 # Primary: f3s cluster (with health checks) - Falls back to localhost when all hosts down forward to port 80 check tcp - # Static landing page served from pi0/pi1 instead of k3s - forward to port 80 check tcp + # Static landing page is routed through a local relay so it can fall back to localhost + forward to port 18080 check tcp forward to port 8080 check http "/" code 200 # Registry uses separate port and table forward to port 30001 check tcp @@ -185,3 +190,15 @@ relay "gemini6" { protocol "gemini" forward to 127.0.0.1 port 11965 } + +relay "f3s_static_proxy4" { + listen on 127.0.0.1 port 18080 + forward to port 80 check tcp + forward to port 8080 check http "/" code 200 +} + +relay "f3s_static_proxy6" { + listen on ::1 port 18080 + forward to port 80 check tcp + forward to port 8080 check http "/" code 200 +} -- cgit v1.2.3