Redirecting to Controller when main react app is down.

This commit is contained in:
Roland 2026-03-07 19:17:38 -07:00
parent 08982647ac
commit 8261df5bef
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
3 changed files with 34 additions and 31 deletions

View file

@ -25,6 +25,10 @@
:443 {
tls /etc/ssl/caddy/cert.crt /etc/ssl/caddy/cert.key
header Access-Control-Allow-Origin "*"
header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
header Access-Control-Allow-Headers "Content-Type, Accept"
handle /favicon.ico {
root * /etc/caddy
rewrite * /favicon.ico
@ -84,13 +88,11 @@
# React app with fallback to Controller.
handle {
reverse_proxy app:3000 {
@bad status 502 503 504
handle_response @bad {
header Location /controller/?fallback=true
respond "" 302
}
}
reverse_proxy app:3000
}
handle_errors 502 503 504 {
redir * "http://{host}:8087/?fallback=true" 302
}
}