library/roles/smartgears/smartgears-nginx-frontend: Add the CORS snippet when enabled.
This commit is contained in:
parent
64f8947dd5
commit
00b6c78bb6
|
@ -4,3 +4,5 @@ http_redirect_to_https: False
|
|||
letsencrypt_acme_install: False
|
||||
smartgears_install_generic_virthost: True
|
||||
#smartgears_nginx_serveraliases:
|
||||
smartgears_nginx_cors_enabled: False
|
||||
nginx_cors_acl_origin: ''
|
||||
|
|
|
@ -59,22 +59,34 @@ server {
|
|||
{% for instance in tomcat_m_instances %}
|
||||
{% for context in instance.app_contexts %}
|
||||
location /{{ context }} {
|
||||
{% if smartgears_nginx_cors_enabled %}
|
||||
include /etc/nginx/snippets/nginx-cors.conf;
|
||||
{% endif %}
|
||||
proxy_pass http://localhost:{{ item.http_port }}/{{ context }};
|
||||
}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% if smart_executor_install is defined and smart_executor_install %}
|
||||
location {{ smart_executor_context }} {
|
||||
{% if smartgears_nginx_cors_enabled %}
|
||||
include /etc/nginx/snippets/nginx-cors.conf;
|
||||
{% endif %}
|
||||
proxy_pass http://localhost:{{ item.http_port }}{{ smart_executor_context }};
|
||||
}
|
||||
{% endif %}
|
||||
{% if rstudio_install_server is defined and rstudio_install_server %}
|
||||
location / {
|
||||
{% if smartgears_nginx_cors_enabled %}
|
||||
include /etc/nginx/snippets/nginx-cors.conf;
|
||||
{% endif %}
|
||||
proxy_pass http://localhost:8787/;
|
||||
}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
location / {
|
||||
{% if smartgears_nginx_cors_enabled %}
|
||||
include /etc/nginx/snippets/nginx-cors.conf;
|
||||
{% endif %}
|
||||
return 301 https://{{ item.servername }}$request_uri;
|
||||
}
|
||||
{% endif %}
|
||||
|
@ -143,17 +155,26 @@ server {
|
|||
{% for instance in tomcat_m_instances %}
|
||||
{% for context in instance.app_contexts %}
|
||||
location /{{ context }} {
|
||||
{% if smartgears_nginx_cors_enabled %}
|
||||
include /etc/nginx/snippets/nginx-cors.conf;
|
||||
{% endif %}
|
||||
proxy_pass http://localhost:{{ item.http_port }}/{{ context }};
|
||||
}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% if smart_executor_install is defined and smart_executor_install %}
|
||||
location {{ smart_executor_context }} {
|
||||
{% if smartgears_nginx_cors_enabled %}
|
||||
include /etc/nginx/snippets/nginx-cors.conf;
|
||||
{% endif %}
|
||||
proxy_pass http://localhost:{{ item.http_port }}{{ smart_executor_context }};
|
||||
}
|
||||
{% endif %}
|
||||
{% if rstudio_install_server is defined and rstudio_install_server %}
|
||||
location / {
|
||||
{% if smartgears_nginx_cors_enabled %}
|
||||
include /etc/nginx/snippets/nginx-cors.conf;
|
||||
{% endif %}
|
||||
proxy_pass http://localhost:8787/;
|
||||
}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue