*) Adding possibility to configure if the http proxy should send the

X-forwarded-for header (requested by TeeSee)
   See: http://www.yacy-forum.de/viewtopic.php?t=2577

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2257 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent ef84fc4956
commit b594ee9a5a

@ -118,6 +118,10 @@ Seed Upload method was changed successfully.
<td>Send via header is:</td>
<td class="settingsValue">#[proxy.sendViaHeader]#</td>
</tr>
<tr>
<td>Send X-Forwarded-For header is:</td>
<td class="settingsValue">#[proxy.sendXForwardedForHeader]#</td>
</tr>
</table>
::<!-- 21: message forwarding -->
<p><b>Your message forwarding settings have been changed.</b></p>

@ -234,6 +234,10 @@ public class SettingsAck_p {
env.setConfig("proxy.sendViaHeader", post.containsKey("proxy.sendViaHeader")?"true":"false");
prop.put("info_proxy.sendViaHeader", post.containsKey("proxy.sendViaHeader")? "on" : "off");
// setting X-Forwarded-for header property
env.setConfig("proxy.sendXForwardedForHeader", post.containsKey("proxy.sendXForwardedForHeader")?"true":"false");
prop.put("info_proxy.sendXForwardedForHeader", post.containsKey("proxy.sendXForwardedForHeader")? "on" : "off");
prop.put("info", 20);
return prop;
}

@ -18,7 +18,12 @@
<td>Send&nbsp;Via&nbsp;Header:</td>
<td><input type="checkbox" name="proxy.sendViaHeader" align="top" #(proxy.sendViaHeader)#::checked#(/proxy.sendViaHeader)#></td>
<td>Specifies if the proxy should send the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.45">Via</a> http header according to RFC 2616 Sect 14.45.</td>
</tr>
</tr>
<tr valign="top">
<td>Send&nbsp;X-Forwarded-For&nbsp;Header:</td>
<td><input type="checkbox" name="proxy.sendXForwardedForHeader" align="top" #(proxy.sendXForwardedForHeader)#::checked#(/proxy.sendXForwardedForHeader)#></td>
<td>Specifies if the proxy should send the X-Forwarded-For http header.</td>
</tr>
<tr valign="top">
<td colspan="3"><input type="submit" name="httpNetworking" value="submit">&nbsp;<i>Changes will take effect immediately.</i></td>
</tr>

@ -117,6 +117,7 @@ public final class Settings_p {
prop.put("isTransparentProxy", env.getConfig("isTransparentProxy", "false").equals("true") ? 1 : 0);
prop.put("connectionKeepAliveSupport", env.getConfig("connectionKeepAliveSupport", "false").equals("true") ? 1 : 0);
prop.put("proxy.sendViaHeader", env.getConfig("proxy.sendViaHeader", "false").equals("true") ? 1 : 0);
prop.put("proxy.sendXForwardedForHeader", env.getConfig("proxy.sendXForwardedForHeader", "true").equals("true") ? 1 : 0);
// remote port forwarding settings
boolean portForwardingAvailable = false;

@ -406,7 +406,9 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
}
// setting the X-Forwarded-For Header
requestHeader.put(httpHeader.X_FORWARDED_FOR,conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
if (switchboard.getConfigBool("proxy.sendXForwardedForHeader", true)) {
requestHeader.put(httpHeader.X_FORWARDED_FOR,conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
}
// decide wether to use a cache entry or connect to the network
File cacheFile = cacheManager.getCachePath(url);
@ -927,7 +929,9 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
}
// setting the X-Forwarded-For Header
requestHeader.put(httpHeader.X_FORWARDED_FOR,conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
if (switchboard.getConfigBool("proxy.sendXForwardedForHeader", true)) {
requestHeader.put(httpHeader.X_FORWARDED_FOR,conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
}
// resolve yacy and yacyh domains
String yAddress = yacyCore.seedDB.resolveYacyAddress(host);
@ -1015,7 +1019,9 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
}
// setting the X-Forwarded-For Header
requestHeader.put(httpHeader.X_FORWARDED_FOR,conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
if (switchboard.getConfigBool("proxy.sendXForwardedForHeader", true)) {
requestHeader.put(httpHeader.X_FORWARDED_FOR,conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP));
}
// resolve yacy and yacyh domains
String yAddress = yacyCore.seedDB.resolveYacyAddress(host);

@ -574,6 +574,9 @@ connectionKeepAliveSupport=true
# Specifies if the proxy should send the via header according to RFC
proxy.sendViaHeader=true
# Specifies if the proxy should send the X-Forwarded-For header
proxy.sendXForwardedForHeader=true
# Configuration options needed to configure server port forwarding
portForwardingEnabled=false
portForwardingUseProxy=false

Loading…
Cancel
Save