diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/nginx/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/nginx/run index e34ad3b1c..0bc891070 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/nginx/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/nginx/run @@ -84,11 +84,6 @@ python3 /usr/local/nginx/get_base_path.py | \ tempio -template /usr/local/nginx/templates/base_path.gotmpl \ -out /usr/local/nginx/conf/base_path.conf -# build templates for optional base_path in web manifest -python3 /usr/local/nginx/get_base_path.py | \ - tempio -template /usr/local/nginx/templates/web_manifest.gotmpl \ - -out /usr/local/nginx/conf/web_manifest.conf - # build templates for optional TLS support python3 /usr/local/nginx/get_tls_settings.py | \ tempio -template /usr/local/nginx/templates/listen.gotmpl \ diff --git a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf index 1306d3610..73d285704 100644 --- a/docker/main/rootfs/usr/local/nginx/conf/nginx.conf +++ b/docker/main/rootfs/usr/local/nginx/conf/nginx.conf @@ -300,7 +300,17 @@ http { add_header Cache-Control "public"; } - include web_manifest.conf; + location ~ ^/.*-([A-Za-z0-9]+)\.webmanifest$ { + access_log off; + expires off; + add_header Cache-Control "public, must-revalidate" always; + default_type application/json; + proxy_set_header Accept-Encoding ""; + sub_filter_once off; + sub_filter_types application/json; + sub_filter '"start_url": "/"' '"start_url" : "$http_x_ingress_path"'; + sub_filter '"src": "/' '"src": "$http_x_ingress_path/'; + } sub_filter 'href="/BASE_PATH/' 'href="$http_x_ingress_path/'; sub_filter 'url(/BASE_PATH/' 'url($http_x_ingress_path/'; diff --git a/docker/main/rootfs/usr/local/nginx/templates/base_path.gotmpl b/docker/main/rootfs/usr/local/nginx/templates/base_path.gotmpl index b018b7af2..91ca85a35 100644 --- a/docker/main/rootfs/usr/local/nginx/templates/base_path.gotmpl +++ b/docker/main/rootfs/usr/local/nginx/templates/base_path.gotmpl @@ -3,15 +3,17 @@ location = {{ .base_path }} { return 302 {{ .base_path }}/; } -location {{ .base_path }}/ { - proxy_http_version 1.1; - proxy_cache_bypass $http_upgrade; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $http_connection; - proxy_set_header Host $http_host; - proxy_set_header X-Ingress-Path {{ .base_path }}; - proxy_set_header Authorization ""; - proxy_pass http:/{{ .base_path }}:5000/; - access_log off; +location /{{ .base_path }}/ { + # remove base_url from the path before passing upstream + rewrite ^/{{ .base_path }}/(.*) /$1 break; + + proxy_pass http://127.0.0.1:8971; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Ingress-Path /{{ .base_path }}; + + access_log off; } {{ end }} \ No newline at end of file diff --git a/docker/main/rootfs/usr/local/nginx/templates/web_manifest.gotmpl b/docker/main/rootfs/usr/local/nginx/templates/web_manifest.gotmpl deleted file mode 100644 index 01892fbd6..000000000 --- a/docker/main/rootfs/usr/local/nginx/templates/web_manifest.gotmpl +++ /dev/null @@ -1,13 +0,0 @@ -{{ if .base_path }} -location ~ ^/.*-([A-Za-z0-9]+)\.webmanifest$ { - access_log off; - expires 1y; - add_header Cache-Control "public"; - default_type application/json; - proxy_set_header Accept-Encoding ""; - sub_filter_once off; - sub_filter_types application/json; - sub_filter '"start_url": "/"' '"start_url" : "{{ .base_path }}"'; - sub_filter '"src": "/' '"src": "{{ .base_path }}/'; -} -{{ end }} \ No newline at end of file