Serve the Partner Radar demo at radar.DOMAIN
A new Caddy site proxies radar.DOMAIN to radar-web:80, the web container of the adamf/cto stack, which joins app-network from its own compose project. It has its own rate-limit zones (radar, radar_login) and answers 503 "offline" when that stack is down. The name is added to Caddy's network aliases and cloudflared's extra_hosts like www. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+6
-1
@@ -292,13 +292,14 @@
|
||||
respond "Too many requests from your address. Wait a moment and retry." 503
|
||||
}
|
||||
|
||||
# An upstream that could not be reached or timed out. Two routes turn that
|
||||
# An upstream that could not be reached or timed out. Three routes turn that
|
||||
# into something better than a bare 502, each keyed on a variable its
|
||||
# route sets (error routes keep the request's vars, and a variable cannot
|
||||
# be spoofed the way a path can be dressed up):
|
||||
# uploads_fallback Garage is down: serve the file from disk instead.
|
||||
# receipt_upstream set only once the permission gate has passed, so a
|
||||
# backend outage is not reported as the printer's.
|
||||
# radar_upstream the Partner Radar stack (radar.DOMAIN) is down.
|
||||
handle_errors 502 504 {
|
||||
@uploads_fallback vars uploads_fallback yes
|
||||
handle @uploads_fallback {
|
||||
@@ -308,6 +309,10 @@
|
||||
handle @receipt_offline {
|
||||
respond "The receipt printer machine is offline." 503
|
||||
}
|
||||
@radar_offline vars radar_upstream yes
|
||||
handle @radar_offline {
|
||||
respond "Partner Radar is offline." 503
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,3 +131,49 @@ www.{$DOMAIN} {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ---- Partner Radar (radar.DOMAIN) ----
|
||||
# The adamf/cto "Partner Radar" demo: its own docker compose project on this
|
||||
# host (`make stpvm` there), whose `web` container (its own Caddy, serving the
|
||||
# React app and proxying its API) joins app-network as `radar-web`. A
|
||||
# subdomain, not a /radar/ path, because the app assumes it owns `/` and its
|
||||
# session cookie then stays apart from www's.
|
||||
#
|
||||
# No admin gate: the app has its own login and accounts. No security_headers
|
||||
# either: the app's Caddy sends its own, and www's CSP would block the React
|
||||
# app. Two zones of its own (see DEPLOYMENT.md §6): `radar` on every request,
|
||||
# and `radar_login` on top of it for the login endpoint. radar_upstream lets
|
||||
# `errors` answer "offline" when the stack is down instead of a bare 502.
|
||||
(radar_proxy) {
|
||||
reverse_proxy {$RADAR_UPSTREAM} {
|
||||
import proxy
|
||||
# Caddy's default, spelt out: when the stack is down, fail fast and
|
||||
# let `errors` answer.
|
||||
transport http {
|
||||
dial_timeout 3s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
radar.{$DOMAIN} {
|
||||
import prod_tls
|
||||
import common
|
||||
header Strict-Transport-Security "max-age=63072000; includeSubDomains"
|
||||
|
||||
route {
|
||||
import limit radar 30 1s
|
||||
request_body {
|
||||
max_size 10MB
|
||||
}
|
||||
vars radar_upstream yes
|
||||
handle /api/auth/login {
|
||||
route {
|
||||
import limit radar_login 5 1m
|
||||
import radar_proxy
|
||||
}
|
||||
}
|
||||
handle {
|
||||
import radar_proxy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user