Migrate the web runner stage from the official nginx alpine image to a standard alpine image with the nginx package installed. This ensures the presence of the `http_sub_module` required for path rewriting in the telemetry proxy configuration. - Replace `nginx:1.27-alpine` with `alpine:3.20` and `apk add nginx` - Update Nginx configuration file path to `/etc/nginx/http.d/default.conf` - Update web asset root directory to `/var/lib/nginx/html` - Add `X-Forwarded-For` and `X-Forwarded-Proto` headers to proxy locations
87 lines
2.9 KiB
Nginx Configuration File
87 lines
2.9 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /var/lib/nginx/html;
|
|
index index.html;
|
|
|
|
location /api/ {
|
|
proxy_pass http://zeavis-api:3000/api/;
|
|
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_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
# Expose API metrics through the web endpoint (Prometheus scrape target)
|
|
location /metrics {
|
|
proxy_pass http://zeavis-api:3000/metrics;
|
|
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_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
# ── Telemetry Dashboard Proxy (orange VPS via Tailscale) ──────────────
|
|
# Telemetry UI SPA assets (fingerprinted by Vite, cache aggressively)
|
|
location /telemetry/assets/ {
|
|
proxy_pass http://100.96.248.86:8181/assets/;
|
|
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_set_header X-Forwarded-Proto $scheme;
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Telemetry API calls (query proxy + target management)
|
|
location /telemetry/proxy/ {
|
|
proxy_pass http://100.96.248.86:8181/proxy/;
|
|
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_set_header X-Forwarded-Proto $scheme;
|
|
proxy_connect_timeout 5s;
|
|
proxy_send_timeout 35s;
|
|
proxy_read_timeout 35s;
|
|
}
|
|
|
|
location /telemetry/api/ {
|
|
proxy_pass http://100.96.248.86:8181/api/;
|
|
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_set_header X-Forwarded-Proto $scheme;
|
|
proxy_connect_timeout 5s;
|
|
proxy_send_timeout 10s;
|
|
proxy_read_timeout 10s;
|
|
}
|
|
|
|
# Telemetry SPA — proxy to orange VPS, rewrite root-relative paths to /telemetry/ prefix
|
|
location /telemetry/ {
|
|
proxy_pass http://100.96.248.86:8181/;
|
|
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_set_header X-Forwarded-Proto $scheme;
|
|
proxy_connect_timeout 5s;
|
|
proxy_send_timeout 35s;
|
|
proxy_read_timeout 35s;
|
|
|
|
# Rewrite root-relative paths (<script src="/", href="/", fetch("/")) to /telemetry/ prefix
|
|
sub_filter_types text/html application/javascript;
|
|
sub_filter_once off;
|
|
sub_filter 'src="/' 'src="/telemetry/';
|
|
sub_filter 'href="/' 'href="/telemetry/';
|
|
sub_filter "url('/" "url('/telemetry/";
|
|
sub_filter 'fetch("/' 'fetch("/telemetry/');
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|