diff --git a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 index a38dbabb..9774db37 100644 --- a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 +++ b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 @@ -69,6 +69,19 @@ server { {% if context != "whn-manager" %} {% if context != '' %} location /{{ context }} { + {% if varnish_install is defined and varnish_install %} + {% if varnish_listen_port is defined %} + {% if smartgears_nginx_cors_enabled %} + include /etc/nginx/snippets/nginx-cors.conf; + {% if nginx_cors_extended_rules %} + proxy_pass http://127.0.0.1:{{ varnish_listen_port }}; + {% else %} + proxy_pass http://127.0.0.1:{{ varnish_listen_port }}/{{ context }}; + {% endif %} + {% else %} + proxy_pass http://127.0.0.1:{{ varnish_listen_port }}/{{ context }}; + {% endif %} + {% else %} {% if smartgears_nginx_cors_enabled %} include /etc/nginx/snippets/nginx-cors.conf; {% if nginx_cors_extended_rules %} @@ -79,6 +92,8 @@ server { {% else %} proxy_pass http://127.0.0.1:{{ item.http_port }}/{{ context }}; {% endif %} + {% endif %} + {% endif %} } {% endif %} {% endif %} @@ -198,6 +213,19 @@ server { {% if context != "whn-manager" %} {% if context != '' %} location /{{ context }} { + {% if varnish_install is defined and varnish_install %} + {% if varnish_listen_port is defined %} + {% if smartgears_nginx_cors_enabled %} + include /etc/nginx/snippets/nginx-cors.conf; + {% if nginx_cors_extended_rules %} + proxy_pass http://127.0.0.1:{{ varnish_listen_port }}; + {% else %} + proxy_pass http://127.0.0.1:{{ varnish_listen_port }}/{{ context }}; + {% endif %} + {% else %} + proxy_pass http://127.0.0.1:{{ varnish_listen_port }}/{{ context }}; + {% endif %} + {% else %} {% if smartgears_nginx_cors_enabled %} include /etc/nginx/snippets/nginx-cors.conf; {% if nginx_cors_extended_rules %} @@ -208,6 +236,8 @@ server { {% else %} proxy_pass http://127.0.0.1:{{ item.http_port }}/{{ context }}; {% endif %} + {% endif %} + {% endif %} } {% endif %} {% endif %}