Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix proxyservlet response url to respect http scheme if a relative Location header is returned.

reger81963a89feec
diff --git a/source/net/yacy/http/servlets/UrlProxyServlet.java b/source/net/yacy/http/servlets/UrlProxyServlet.java
index 74a2e3289..390f8d08a 100644
--- a/source/net/yacy/http/servlets/UrlProxyServlet.java
+++ b/source/net/yacy/http/servlets/UrlProxyServlet.java
@@ -184,7 +184,7 @@ public class UrlProxyServlet extends HttpServlet implements Servlet {
if (location.startsWith("http")) {
location = request.getServletPath() + "?url=" + location;
} else {
- location = request.getServletPath() + "?url=http://" + hostwithport + "/" + location;
+ location = request.getServletPath() + "?url=" + proxyurl.getProtocol() + "://" + hostwithport + "/" + location;
}
response.addHeader(HeaderFramework.LOCATION, location);
}
diff --git a/source/net/yacy/http/servlets/YaCyProxyServlet.java b/source/net/yacy/http/servlets/YaCyProxyServlet.java
index f259cfd4c..f2b697488 100644
--- a/source/net/yacy/http/servlets/YaCyProxyServlet.java
+++ b/source/net/yacy/http/servlets/YaCyProxyServlet.java
@@ -161,7 +161,7 @@ public class YaCyProxyServlet extends HttpServlet implements Servlet {
if (location.startsWith("http")) {
location = request.getServletPath() + "?url=" + location;
} else {
- location = request.getServletPath() + "?url=http://" + hostwithport + "/" + location;
+ location = request.getServletPath() + "?url=" + proxyurl.getProtocol() + "://" + hostwithport + "/" + location;
}
response.addHeader(HeaderFramework.LOCATION, location);
}