try_files avoids 404s, redirecting to SPA root; catch-all handles unknown paths for selfhost-web.
27 lines
611 B
Caddyfile
27 lines
611 B
Caddyfile
:3000 {
|
|
# Serve the `selfhost-web` SPA by default
|
|
root * /site/selfhost-web
|
|
file_server
|
|
|
|
# Handle requests under `/admin*`
|
|
handle_path /admin* {
|
|
root * /site/sh-admin
|
|
file_server
|
|
|
|
# Ensures any non-existent file in the server is routed to the SPA
|
|
try_files {path} /
|
|
}
|
|
|
|
# Handle requests under `/backend*` path
|
|
handle_path /backend* {
|
|
reverse_proxy localhost:3170
|
|
}
|
|
|
|
# Catch-all route for unknown paths, serves `selfhost-web` SPA
|
|
handle {
|
|
root * /site/selfhost-web
|
|
file_server
|
|
try_files {path} /
|
|
}
|
|
}
|