mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 21:37:41 +00:00
43 lines
No EOL
1.3 KiB
Text
43 lines
No EOL
1.3 KiB
Text
upstream app {
|
|
server 127.0.0.1:8080;
|
|
}
|
|
|
|
server {
|
|
listen 4040;
|
|
|
|
set $base_path "${HYPERDX_BASE_PATH}";
|
|
if ($base_path = "/") {
|
|
set $base_path "";
|
|
}
|
|
|
|
# Common proxy headers
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
# Redirect root to base path, if a base path is set
|
|
location = / {
|
|
if ($base_path != "") {
|
|
return 301 $base_path;
|
|
}
|
|
# If no base path, just proxy to the app
|
|
proxy_pass http://app;
|
|
}
|
|
|
|
# This handles assets and api calls made to the root and rewrites them to include the base path
|
|
location ~ ^(/api/|/_next/|/__ENV\.js$|/Icon32\.png$) {
|
|
# Note: $request_uri includes the original full path including query string
|
|
proxy_pass http://app$base_path$request_uri;
|
|
}
|
|
|
|
# Proxy requests that are already prefixed with the base path to the app
|
|
location ${HYPERDX_BASE_PATH} {
|
|
# The full request URI (e.g., /hyperdx/settings) is passed to the upstream
|
|
proxy_pass http://app;
|
|
}
|
|
} |