Production traffic enters through Caddy, which terminates TLS for the public domain and the CMS subdomain and sets HSTS and the other security headers. PostgreSQL, Strapi and Nuxt publish no ports of their own. docker-compose.dev.yml publishes the ports on localhost and drops Caddy for local testing. It is a separate file rather than an override.yml so it can only be applied when passed explicitly, never by accident in production.
30 lines
538 B
Caddyfile
30 lines
538 B
Caddyfile
{
|
|
email {$ACME_EMAIL}
|
|
}
|
|
|
|
(security_headers) {
|
|
header {
|
|
Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
|
X-Content-Type-Options "nosniff"
|
|
X-Frame-Options "SAMEORIGIN"
|
|
Referrer-Policy "strict-origin-when-cross-origin"
|
|
-Server
|
|
}
|
|
}
|
|
|
|
{$PUBLIC_DOMAIN} {
|
|
import security_headers
|
|
encode zstd gzip
|
|
reverse_proxy frontend:3000
|
|
}
|
|
|
|
{$CMS_DOMAIN} {
|
|
import security_headers
|
|
encode zstd gzip
|
|
# Uploaded media can be large; Strapi's own limit still applies.
|
|
request_body {
|
|
max_size 100MB
|
|
}
|
|
reverse_proxy cms:1337
|
|
}
|