# Enable gzipping of responses. gzip on; map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { server_name _; listen 8099 default_server; location / { proxy_pass http://localhost:4000/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Referer $http_referer; # Disable encoding to allow the sub_filter to work proxy_set_header Accept-Encoding ""; # Enable sub-filtering sub_filter_types text/css text/xml application/javascript; sub_filter_once off; # Home URLs in the HTML sub_filter 'href="/"' 'href="$http_x_ingress_path/"'; # Fonts in the CSS sub_filter 'url(/' 'url($http_x_ingress_path/'; # Update fixed paths in the .js files sub_filter '"/live"' '"$http_x_ingress_path/live"'; sub_filter '"/js/"' '"$http_x_ingress_path/js/"'; } }