build(web): switch to alpine-based nginx runner for sub_filter support
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
This commit is contained in:
+5
-3
@@ -1,7 +1,7 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
root /var/lib/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location /api/ {
|
||||
@@ -28,6 +28,8 @@ server {
|
||||
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";
|
||||
}
|
||||
@@ -57,7 +59,7 @@ server {
|
||||
proxy_read_timeout 10s;
|
||||
}
|
||||
|
||||
# Telemetry SPA — proxy to orange, rewrite root-relative paths to prefix
|
||||
# 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;
|
||||
@@ -69,7 +71,7 @@ server {
|
||||
proxy_send_timeout 35s;
|
||||
proxy_read_timeout 35s;
|
||||
|
||||
# Rewrite root-relative paths in HTML/JS to /telemetry/ prefix
|
||||
# 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/';
|
||||
|
||||
Reference in New Issue
Block a user