MyBB Community Forums

Full Version: reCaptcha not work if use SSL (HTTPS)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
reCaptcha not work if use SSL (HTTPS)

Solution:
in line 141 of class_captcha.php
			$this->server = "http://www.google.com/recaptcha/api";
			$this->secure_server = "https://www.google.com/recaptcha/api";

should be:
			$this->server = "//www.google.com/recaptcha/api";
			$this->secure_server = "//www.google.com/recaptcha/api";
Confirmed
Your change would work, however it makes the secure_server variable useless. You'd also need to remove it and replace it with server instead.
(2014-10-14, 08:11 AM)Jones H Wrote: [ -> ]Your change would work, however it makes the secure_server variable useless. You'd also need to remove it and replace it with server instead.

IMO that would be the best solution. 
There was an issue about this on RedMine and Stefan decided to fix it with the secure_server variable instead of removing the protocol. I'm not 100% sure why, however we can't access RedMine atm.
I can testify that that it is not an issue with mybb. As my recaptcha is working just fine. May be your configs?
This issue for CloudFlare (because your host isn't secure And you use CloudFlare SSL)
For fix, you can change line 193:
		if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')
to
		if((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
(2014-10-21, 01:00 PM)My-BB.Ir Wrote: [ -> ]This issue for CloudFlare (because your host isn't secure And you use CloudFlare SSL)
For fix, you can change line 193:
		if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')
to
		if((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))

thanks for information...
i will move to new VPS, so after this i will install SSL in my VPS... i think better...
@My-BB.Ir i tried your solution, but not work for me...

and anime-forum.info i used Full SSL mode (cloudflare)

Quote:Full SSL  --  SSL between the visitor and CloudFlare -- visitor sees HTTPS on your site, and SSL between CloudFlare and your web server. You'll need to have your own SSL cert or self-signed cert at the very least.

[Image: 5d4O8km.png]

But problem persist...
for me best solution to user that use Cloudflare SSL is use https in both:

$this->server = "https://www.google.com/recaptcha/api";
$this->secure_server = "https://www.google.com/recaptcha/api";

and for me i don´t know why not use only https in recaptcha
Pages: 1 2