[OJS] ReCaptcha proxy problem

After upgrading to OJS and migrating to new server our sites have problem with reCaptcha service.

I have looked up for problem and find that


have old proxy settings that are not contained in config.inc.php

Proxy is now defined like this:

; The HTTP proxy configuration to use
http_proxy = "http://proxy.uns.ac.rs:8080"
https_proxy = "http://proxy.uns.ac.rs:8080"

but in /lib/pkp/classes/form/validation/FormValidatorReCaptcha.inc.php we have old way of defining proxy (unless I am wrong):

		$proxySettings = array(
			'host' => Config::getVar('proxy', 'http_host'),
			'port' => Config::getVar('proxy', 'http_port'),
			'user' => Config::getVar('proxy', 'proxy_username'),
			'pass' => Config::getVar('proxy', 'proxy_password'),

we don’t define http_host and http_port anywhere

This produce error in log: mod_fcgid: stderr: PHP Warning: file_get_contents(https://www.recaptcha.net/recaptcha/api/siteverify): failed to open stream: Network is unreachable in /var/www/clients/client1/web5/web/lib/pkp/classes/form/validation/FormValidatorReCaptcha.inc.php on line 89, referer: https://godisnjak.ff.uns.ac.rs/index.php/gff/user/register

When we add old definition for proxy in config.inc.php recaptcha work again:

; Proxy Settings ;


; The HTTP proxy configuration to use
http_proxy = "http://proxy.uns.ac.rs:8080"
http_host = proxy.uns.ac.rs
http_port = 8080
https_proxy = "http://proxy.uns.ac.rs:8080"
1 Like