fix: ensure any non-existent file in the server is routed to the corresponding SPA
try_files avoids 404s, redirecting to SPA root; catch-all handles unknown paths for selfhost-web.
This commit is contained in:
@@ -1,13 +1,26 @@
|
||||
:3000 {
|
||||
root * /site/selfhost-web
|
||||
file_server
|
||||
|
||||
handle_path /admin* {
|
||||
root * /site/sh-admin
|
||||
# Serve the `selfhost-web` SPA by default
|
||||
root * /site/selfhost-web
|
||||
file_server
|
||||
}
|
||||
|
||||
handle_path /backend* {
|
||||
reverse_proxy localhost:3170
|
||||
}
|
||||
# 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} /
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user