Serve the CMS admin panel under /admin on the public domain
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.
This commit is contained in:
+15
-9
@@ -15,15 +15,21 @@
|
||||
{$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
|
||||
# /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
|
||||
}
|
||||
reverse_proxy cms:1337
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user