Replace the separate CMS subdomain with path-based routing in Caddy: /admin and /uploads go to Strapi, everything else to the frontend. Strapi 5 nests its whole admin panel (UI and API) under /admin, so this one prefix is enough and never collides with the frontend's own /api routes. Drops CMS_DOMAIN and the unused STRAPI_URL env var on the cms service; PUBLIC_STRAPI_URL now points at the same origin as the site. Authentication is unchanged: Strapi's own admin login still gates the panel, this only changes how it's reached.
36 lines
811 B
Caddyfile
36 lines
811 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
|
|
|
|
# /admin and /uploads go to Strapi; everything else to the frontend.
|
|
# Strapi 5 nests the whole admin panel (UI + its own API) under /admin,
|
|
# so this single prefix is enough - it never touches /api, which stays
|
|
# reserved for the frontend's own Nitro endpoints.
|
|
@cms path /admin* /uploads*
|
|
handle @cms {
|
|
# Uploaded media can be large; Strapi's own limit still applies.
|
|
request_body {
|
|
max_size 100MB
|
|
}
|
|
reverse_proxy cms:1337
|
|
}
|
|
|
|
handle {
|
|
reverse_proxy frontend:3000
|
|
}
|
|
}
|