This commit is contained in:
parent
934c94cb5c
commit
1b59b548fa
3 changed files with 16 additions and 12 deletions
|
|
@ -82,16 +82,20 @@ catcrafts.net {
|
|||
handle {
|
||||
reverse_proxy 127.0.0.1:8081 {
|
||||
health_uri /api/healthz
|
||||
|
||||
# If the backend is down, fall back to the static wasm shell so the
|
||||
# site degrades to a client-rendered app rather than a Caddy 502.
|
||||
# Content still renders; only real status codes and SSR are lost.
|
||||
@down status 502 503 504
|
||||
handle_response @down {
|
||||
rewrite * /index.html
|
||||
header Cache-Control "no-store"
|
||||
file_server
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# If the backend is down, fall back to the static wasm shell so the site
|
||||
# degrades to a client-rendered app rather than a bare Caddy error page.
|
||||
# This must be handle_errors, not handle_response: handle_response only
|
||||
# fires on responses an upstream actually sent, and a backend that is not
|
||||
# running refuses the connection — that is an error, which only
|
||||
# handle_errors sees (verified against a dead port). The error status is
|
||||
# kept, so a crawler sees the honest 502 while a human gets the working
|
||||
# client-rendered app; only SSR and real 404s are lost.
|
||||
handle_errors 502 503 504 {
|
||||
rewrite * /index.html
|
||||
header Cache-Control "no-store"
|
||||
file_server
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue