45 lines
1.2 KiB
Caddyfile
45 lines
1.2 KiB
Caddyfile
{$DOMAIN} {
|
|
encode gzip
|
|
|
|
# Security headers. HSTS is deliberately left commented until the domain is
|
|
# confirmed — turning it on before you are certain about HTTPS locks browsers in.
|
|
header {
|
|
X-Content-Type-Options nosniff
|
|
X-Frame-Options DENY
|
|
Referrer-Policy strict-origin-when-cross-origin
|
|
# Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
|
-Server
|
|
}
|
|
|
|
# API and API documentation stay behind the FastAPI service. Everything else
|
|
# is the React single-page application served by the lightweight web container.
|
|
handle /api/* {
|
|
reverse_proxy api:8000
|
|
}
|
|
handle /docs* {
|
|
reverse_proxy api:8000
|
|
}
|
|
handle /redoc* {
|
|
reverse_proxy api:8000
|
|
}
|
|
handle /openapi.json {
|
|
reverse_proxy api:8000
|
|
}
|
|
handle /health {
|
|
reverse_proxy api:8000
|
|
}
|
|
# Hashed build files never change, so they may be cached for a year. The app shell
|
|
# (index.html) must be re-checked every time, or a user keeps running the old
|
|
# version after a deploy until they hard-refresh.
|
|
handle /assets/* {
|
|
reverse_proxy web:80 {
|
|
header_down Cache-Control "public, max-age=31536000, immutable"
|
|
}
|
|
}
|
|
handle {
|
|
reverse_proxy web:80 {
|
|
header_down Cache-Control "no-cache"
|
|
}
|
|
}
|
|
}
|