forked from ISTI-ansible-roles/ansible-roles
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
|
letsencrypt_acme_install: False
|
||||||
smartgears_install_generic_virthost: True
|
smartgears_install_generic_virthost: True
|
||||||
#smartgears_nginx_serveraliases:
|
#smartgears_nginx_serveraliases:
|
||||||
|
smartgears_nginx_cors_enabled: False
|
||||||
|
nginx_cors_acl_origin: ''
|
||||||
|
|
|
@ -59,22 +59,34 @@ server {
|
||||||
{% for instance in tomcat_m_instances %}
|
{% for instance in tomcat_m_instances %}
|
||||||
{% for context in instance.app_contexts %}
|
{% for context in instance.app_contexts %}
|
||||||
location /{{ context }} {
|
location /{{ context }} {
|
||||||
|
{% if smartgears_nginx_cors_enabled %}
|
||||||
|
include /etc/nginx/snippets/nginx-cors.conf;
|
||||||
|
{% endif %}
|
||||||
proxy_pass http://localhost:{{ item.http_port }}/{{ context }};
|
proxy_pass http://localhost:{{ item.http_port }}/{{ context }};
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if smart_executor_install is defined and smart_executor_install %}
|
{% if smart_executor_install is defined and smart_executor_install %}
|
||||||
location {{ smart_executor_context }} {
|
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 }};
|
proxy_pass http://localhost:{{ item.http_port }}{{ smart_executor_context }};
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if rstudio_install_server is defined and rstudio_install_server %}
|
{% if rstudio_install_server is defined and rstudio_install_server %}
|
||||||
location / {
|
location / {
|
||||||
|
{% if smartgears_nginx_cors_enabled %}
|
||||||
|
include /etc/nginx/snippets/nginx-cors.conf;
|
||||||
|
{% endif %}
|
||||||
proxy_pass http://localhost:8787/;
|
proxy_pass http://localhost:8787/;
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
location / {
|
location / {
|
||||||
|
{% if smartgears_nginx_cors_enabled %}
|
||||||
|
include /etc/nginx/snippets/nginx-cors.conf;
|
||||||
|
{% endif %}
|
||||||
return 301 https://{{ item.servername }}$request_uri;
|
return 301 https://{{ item.servername }}$request_uri;
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -143,17 +155,26 @@ server {
|
||||||
{% for instance in tomcat_m_instances %}
|
{% for instance in tomcat_m_instances %}
|
||||||
{% for context in instance.app_contexts %}
|
{% for context in instance.app_contexts %}
|
||||||
location /{{ context }} {
|
location /{{ context }} {
|
||||||
|
{% if smartgears_nginx_cors_enabled %}
|
||||||
|
include /etc/nginx/snippets/nginx-cors.conf;
|
||||||
|
{% endif %}
|
||||||
proxy_pass http://localhost:{{ item.http_port }}/{{ context }};
|
proxy_pass http://localhost:{{ item.http_port }}/{{ context }};
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if smart_executor_install is defined and smart_executor_install %}
|
{% if smart_executor_install is defined and smart_executor_install %}
|
||||||
location {{ smart_executor_context }} {
|
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 }};
|
proxy_pass http://localhost:{{ item.http_port }}{{ smart_executor_context }};
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if rstudio_install_server is defined and rstudio_install_server %}
|
{% if rstudio_install_server is defined and rstudio_install_server %}
|
||||||
location / {
|
location / {
|
||||||
|
{% if smartgears_nginx_cors_enabled %}
|
||||||
|
include /etc/nginx/snippets/nginx-cors.conf;
|
||||||
|
{% endif %}
|
||||||
proxy_pass http://localhost:8787/;
|
proxy_pass http://localhost:8787/;
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue