diff --git a/config/vufind/config.ini b/config/vufind/config.ini index b804c92fb9b49a4703e8b82bc15d5a48d67ff053..05cc919264d4ecb870f49bbe7a509d75e534a411 100644 --- a/config/vufind/config.ini +++ b/config/vufind/config.ini @@ -1313,8 +1313,16 @@ url = https://www.myendnoteweb.com/EndNoteWeb.html ;host = your.proxy.server ;port = 8000 -; Uncomment following line to set proxy type to SOCKS 5 +; Uncomment one of the following lines to set proxy type to SOCKS 5 or SOCKS 5 with +; name resolution done by proxy. Setting either of these will make VuFind use the +; curl adapter for HTTP requests. ;type = socks5 +;type = socks5_hostname +; This setting can be used to define a reqular expression pattern for addresses that +; should be considered local and bypass proxy when making requests. Default is: +;local_addresses = "@^(localhost|127(\.\d+){3}|\[::1\])@" +; Following example bypasses also any address starting with '192.168.': +;local_addresses = "@^(localhost|127(\.\d+){3}|\[::1\]|192\.168\.)@" ; Default HTTP settings can be loaded here. These values will be passed to ; the \Zend\Http\Client's setOptions method. diff --git a/local/config/vufind/config.ini b/local/config/vufind/config.ini index 94f2c250dbc9f9c716c3315f47da1dbbee3deda2..ba72c6c8e788d89465b478352c796b6ec12494a8 100644 --- a/local/config/vufind/config.ini +++ b/local/config/vufind/config.ini @@ -1327,8 +1327,16 @@ url = https://www.myendnoteweb.com/EndNoteWeb.html ;host = your.proxy.server ;port = 8000 -; Uncomment following line to set proxy type to SOCKS 5 -;type = socks5 +; Uncomment one of the following lines to set proxy type to SOCKS 5 or SOCKS 5 with +; name resolution done by proxy. Setting either of these will make VuFind use the +; curl adapter for HTTP requests. +; type = socks5 +; type = socks5_hostname +; This setting can be used to define a reqular expression pattern for addresses that +; should be considered local and bypass proxy when making requests. Default is: +; local_addresses = "@^(localhost|127(\.\d+){3}|\[::1\])@" +; Following example bypasses also any address starting with '192.168.': +; local_addresses = "@^(localhost|127(\.\d+){3}|\[::1\]|192\.168\.)@" ; Default HTTP settings can be loaded here. These values will be passed to ; the \Zend\Http\Client's setOptions method. diff --git a/module/VuFind/src/VuFind/Service/HttpServiceFactory.php b/module/VuFind/src/VuFind/Service/HttpServiceFactory.php index b4801c73280a44d1b9fce4d17295b959d0839875..c907119c349068c368b631d480335ecaea58c212 100644 --- a/module/VuFind/src/VuFind/Service/HttpServiceFactory.php +++ b/module/VuFind/src/VuFind/Service/HttpServiceFactory.php @@ -75,6 +75,8 @@ class HttpServiceFactory implements FactoryInterface } $defaults = isset($config->Http) ? $config->Http->toArray() : []; - return new $requestedName($options, $defaults); + $config = !empty($config->Proxy->local_addresses) + ? ['localAddressesRegEx' => $config->Proxy->local_addresses] : []; + return new $requestedName($options, $defaults, $config); } }