diff --git a/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf b/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf index 25998f5b2..450e02bf5 100644 --- a/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf +++ b/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf @@ -18,12 +18,6 @@ server { proxy_set_header X-Script-Name %%ingress_entry%%; proxy_cookie_path / %%ingress_entry%%/; - # Rewrite url - sub_filter_once off; - sub_filter_types *; - sub_filter "/static" "%%ingress_entry%%/static"; - sub_filter "/media" "%%ingress_entry%%/media"; - # Allow frames proxy_hide_header "Content-Security-Policy"; add_header X-Frame-Options SAMEORIGIN; @@ -47,7 +41,13 @@ server { proxy_set_header X-Forwarded-Proto $x_scheme; # Correct url without port when using https + sub_filter_once off; + sub_filter_types *; sub_filter https://$host/ $x_scheme://$host$x_port/; sub_filter http://$host/ $x_scheme://$host$x_port/; + + # Rewrite url + sub_filter "/static" "$x_scheme://$host$x_port%%ingress_entry%%/static"; + sub_filter "/media" "$x_scheme://$host$x_port%%ingress_entry%%/media"; } }