diff --git a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 index b9843c0b..5da25071 100644 --- a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 +++ b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 @@ -65,8 +65,10 @@ server { location /{{ context }} { {% if smartgears_nginx_cors_enabled %} include /etc/nginx/snippets/nginx-cors.conf; - {% endif %} + proxy_pass http://localhost:{{ item.http_port }}; + {% else %} proxy_pass http://localhost:{{ item.http_port }}/{{ context }}; + {% endif %} } {% endif %} {% endif %} @@ -101,9 +103,6 @@ server { {% else %} location / { - {% if smartgears_nginx_cors_enabled %} - include /etc/nginx/snippets/nginx-cors.conf; - {% endif %} return 301 https://{{ item.servername }}$request_uri; } {% endif %} @@ -178,8 +177,10 @@ server { location /{{ context }} { {% if smartgears_nginx_cors_enabled %} include /etc/nginx/snippets/nginx-cors.conf; - {% endif %} + proxy_pass http://localhost:{{ item.http_port }}; + {% else %} proxy_pass http://localhost:{{ item.http_port }}/{{ context }}; + {% endif %} } {% endif %} {% endif %}