Add a special case for varnish in the smartgears nginx template. See https://support.d4science.org/issues/10147

This commit is contained in:
Andrea Dell'Amico 2017-11-22 18:21:58 +01:00
parent 5d81cc4f57
commit 40ee8a6fc7
1 changed files with 30 additions and 0 deletions

View File

@ -69,6 +69,19 @@ server {
{% if context != "whn-manager" %} {% if context != "whn-manager" %}
{% if context != '' %} {% if context != '' %}
location /{{ 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 %} {% if smartgears_nginx_cors_enabled %}
include /etc/nginx/snippets/nginx-cors.conf; include /etc/nginx/snippets/nginx-cors.conf;
{% if nginx_cors_extended_rules %} {% if nginx_cors_extended_rules %}
@ -79,6 +92,8 @@ server {
{% else %} {% else %}
proxy_pass http://127.0.0.1:{{ item.http_port }}/{{ context }}; proxy_pass http://127.0.0.1:{{ item.http_port }}/{{ context }};
{% endif %} {% endif %}
{% endif %}
{% endif %}
} }
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -198,6 +213,19 @@ server {
{% if context != "whn-manager" %} {% if context != "whn-manager" %}
{% if context != '' %} {% if context != '' %}
location /{{ 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 %} {% if smartgears_nginx_cors_enabled %}
include /etc/nginx/snippets/nginx-cors.conf; include /etc/nginx/snippets/nginx-cors.conf;
{% if nginx_cors_extended_rules %} {% if nginx_cors_extended_rules %}
@ -208,6 +236,8 @@ server {
{% else %} {% else %}
proxy_pass http://127.0.0.1:{{ item.http_port }}/{{ context }}; proxy_pass http://127.0.0.1:{{ item.http_port }}/{{ context }};
{% endif %} {% endif %}
{% endif %}
{% endif %}
} }
{% endif %} {% endif %}
{% endif %} {% endif %}