diff --git a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 index 1b5bf871..87daa580 100644 --- a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 +++ b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 @@ -67,6 +67,7 @@ server { {% for instance in tomcat_m_instances %} {% for context in instance.app_contexts %} {% if context != "whn-manager" %} + {% if context != "uri-resolver" %} {% if context != '' %} location /{{ context }} { {% if varnish_install is defined and varnish_install %} @@ -95,6 +96,7 @@ server { } {% endif %} {% endif %} + {% endif %} {% endfor %} {% endfor %} {% if smart_executor_install is defined and smart_executor_install %} @@ -157,7 +159,10 @@ server { {% if smartgears_nginx_cors_enabled %} include /etc/nginx/snippets/nginx-cors.conf; {% endif %} - proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/uri-resolver/; + rewrite ^ $request_uri; + rewrite ^/(.*) uri-resolver/$1 break; + return 400; #if the second rewrite won't match + proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/$uri; } {% endif %} @@ -238,6 +243,7 @@ server { {% for instance in tomcat_m_instances %} {% for context in instance.app_contexts %} {% if context != "whn-manager" %} + {% if context != "uri-resolver" %} {% if context != '' %} location /{{ context }} { {% if varnish_install is defined and varnish_install %} @@ -266,6 +272,7 @@ server { } {% endif %} {% endif %} + {% endif %} {% endfor %} {% endfor %} {% if smart_executor_install is defined and smart_executor_install %} @@ -320,14 +327,20 @@ server { allow {{ ip }}; {% endfor %} deny all; - proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/uri-resolver/geonetwork; + rewrite ^ $request_uri; + rewrite ^/(.*) uri-resolver/$1 break; + return 400; #if the second rewrite won't match + proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/$uri; } location / { {% if smartgears_nginx_cors_enabled %} include /etc/nginx/snippets/nginx-cors.conf; {% endif %} - proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/uri-resolver/; + rewrite ^ $request_uri; + rewrite ^/(.*) uri-resolver/$1 break; + return 400; #if the second rewrite won't match + proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/$uri; } {% endif %}