New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists

Feature Proposal: Add a 'NoProxy' configuration option to Foswiki::Net


For now configuring a proxy is an all-or-nothing setting.

Description and Documentation

Users may want to disable proxy connections by domain, i.e. when external internet connections have to go by proxy but not those in an intranet located before a firewall.

Under certain conditions it makes sense to skip the proxy when querying the same site the foswiki is on using %INCLUDE.





This has to work for both implementations part of Foswiki::Net, via LWP::Useragent as well as raw IO::Socket.

diff --git a/core/lib/Foswiki/ b/core/lib/Foswiki/
index d7c426f..69f5e8e 100644
--- a/core/lib/Foswiki/
+++ b/core/lib/Foswiki/
@@ -123,8 +123,14 @@ sub getExternalResource {
     require URI::URL;
     my $uri       = URI::URL->new($url);
+    my $uriHost   = $uri->host;
     my $proxyHost = $this->{PROXYHOST} || $Foswiki::cfg{PROXY}{HOST};
-    my $puri      = $proxyHost ? URI::URL->new($proxyHost) : undef;
+    my $noProxy   = $Foswiki::cfg{PROXY}{NoProxy} || '';
+    my $puri;
+    if ( $proxyHost && $noProxy !~ /\b\Q$uriHost\E\b/i ) {
+        $puri = URI::URL->new($proxyHost);
+    }

diff --git a/core/lib/Foswiki.spec b/core/lib/Foswiki.spec
index 16fda83..8267cb0 100644
--- a/core/lib/Foswiki.spec
+++ b/core/lib/Foswiki.spec
@@ -1074,6 +1074,10 @@ $Foswiki::cfg{AccessibleHeaders} = ['Accept-Language', 'User-Agent'];
 $Foswiki::cfg{PROXY}{HOST} = undef;
+# **STRING 50 LABEL="No Proxy" CHECK="undefok emptyok"**
+# List of domains that are accessed directly instead of going by the proxy.
+$Foswiki::cfg{PROXY}{NoProxy} = '';

-- Contributors: MichaelDaum - 14 Apr 2016


+1 Sounds like a well needed change. I believe that we've had others comment about this issue. See Tasks.Item1400. That tasks suggests {PROXY}{SkipProxyForDomains} for the configuration key.

-- GeorgeClark - 16 Apr 2016

Shame this hasn't been implemented yet. Calling the parameter {SkipProxyForDomains} is fine as well. However I like {NoProxy} more as that's how it is called in LWP::UserAgent.

-- MichaelDaum - 19 Apr 2016
Topic revision: r7 - 01 Dec 2017, MichaelDaum - This page was cached on 20 Sep 2018 - 16:33.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy