diff --git a/web/src/main/java/org/fao/geonet/proxy/URITemplateProxyServlet.java b/web/src/main/java/org/fao/geonet/proxy/URITemplateProxyServlet.java index 0374423f292..b79837fe9d5 100644 --- a/web/src/main/java/org/fao/geonet/proxy/URITemplateProxyServlet.java +++ b/web/src/main/java/org/fao/geonet/proxy/URITemplateProxyServlet.java @@ -362,6 +362,7 @@ protected void service(HttpServletRequest servletRequest, HttpServletResponse se } catch (SecurityException securityException) { servletResponse.sendError(HttpServletResponse.SC_FORBIDDEN, securityException.getMessage()); + return; } // Check if the link requested is in database link list @@ -375,19 +376,16 @@ protected void service(HttpServletRequest servletRequest, HttpServletResponse se LinkSpecs.filter(host, null, null, null, null, null)); if (linksFound == 0) { - String message = String.format( - "The proxy does not allow to access '%s' " + - "because the URL host was not registered in any metadata records.", - uri - ); + String message = "The proxy does not allow to access the requested URI " + + "because the URL host was not registered in any metadata records."; if (linkRepository.count() == 0) { - servletResponse.sendError(HttpServletResponse.SC_FORBIDDEN, - "The proxy is configured with DB_LINK_CHECK mode " + - "but the MetadataLink table is empty. " + - "Administrator may need to analyze record links from the admin console " + - "in order to register URL allowed by the proxy. " + message); + message = "The proxy is configured with DB_LINK_CHECK mode " + + "but the MetadataLink table is empty. " + + "Administrator may need to analyze record links from the admin console " + + "in order to register URL allowed by the proxy."; } servletResponse.sendError(HttpServletResponse.SC_FORBIDDEN, message); + return; } proxyCallAllowed = linksFound > 0; } catch (URISyntaxException e) {