49 lines
1.5 KiB
Nginx Configuration File
49 lines
1.5 KiB
Nginx Configuration File
server {
|
|
listen 8080;
|
|
server_name _;
|
|
|
|
access_log /dev/stdout;
|
|
error_log /dev/stderr;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Keep API/proxy redirects relative so port-forwarded access (ssh -L) is
|
|
# not bounced to an unreachable absolute URL.
|
|
absolute_redirect off;
|
|
port_in_redirect off;
|
|
|
|
# Hand-typed API URLs that fail to parse (e.g. raw % in a path segment)
|
|
# should land on the SPA instead of nginx's default 400 page.
|
|
error_page 400 /index.html;
|
|
|
|
# `/api/v1` without trailing slash must reach the service info endpoint
|
|
# too, not the SPA fallback.
|
|
location = /api/v1 {
|
|
proxy_pass http://127.0.0.1:9557;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_read_timeout 300s;
|
|
proxy_send_timeout 300s;
|
|
}
|
|
|
|
# query service has no CORS headers and no authentication: the API must be
|
|
# served same-origin with the UI.
|
|
location /api/v1/ {
|
|
proxy_pass http://127.0.0.1:9557;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_read_timeout 300s;
|
|
proxy_send_timeout 300s;
|
|
}
|
|
|
|
# SPA fallback: routing is client-side.
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|