Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Tue Jun 06, 2023 9:25 am


Author Message
mandrei99
Post  Post subject: Google reCaptcha not showing in phpbb 3 after moving from HTTP to HTTPS  |  Posted: Mon Feb 16, 2015 9:57 am

Joined: Tue Aug 04, 2009 9:16 am
Posts: 250

Offline
 

Google reCaptcha not showing in phpbb 3 after moving from HTTP to HTTPS

If you've recently moved phpbb from http to HTTPS and your recaptcha image is not shown on registration page, you might need some extra work.

PHPBB recaptcha module is checking if the protocol is HTTP or HTTPS in includes/captcha/plugins/phpbb_recaptcha_plugin.php:






Code:
class phpbb_recaptcha extends phpbb_default_captcha
{
   var $recaptcha_server = 'http://www.google.com/recaptcha/api';
   var $recaptcha_server_secure = 'https://www.google.com/recaptcha/api'; // class constants :(

   // We are opening a socket to port 80 of this host and send
   // the POST request asking for verification to the path specified here.
   var $recaptcha_verify_server = 'www.google.com';
   var $recaptcha_verify_path = '/recaptcha/api/verify';

   var $challenge;
   var $response;

   // PHP4 Constructor
   function phpbb_recaptcha()
   {
      $this->recaptcha_server = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? $this->recaptcha_server_secure : $this->recaptcha_server;
   }

   function init($type)


If the webserver is ngin, the fastcgi_params.txt file does not instruct nginx to send "HTTPS" variable set to "on" to php. Change it accordingly:
Code:
grep HTTPS /etc/nginx/conf.d/fastcgi_params.txt
                fastcgi_param  HTTPS                            on;


Without this, the recaptcha plugin will instruct the browser to load insecure content on a secure webpage (http://www.google.com/recaptcha/api/challenge?k=<recaptcha-key>) and browser will fail to load the recaptcha image.





Top
mandrei99
Post  Post subject: Re: Google reCaptcha not showing in phpbb 3 after moving from HTTP to HTTPS  |  Posted: Mon Feb 16, 2015 10:47 am

Joined: Tue Aug 04, 2009 9:16 am
Posts: 250

Offline
Extra note: This needs to be added only for the virtual host serving phpbb under HTTPS. If the fastcgi_params.txt file is used for multiple virtual hosts both HTTP and HTTPS, it is best to modify your nginx server configuration only for the HTTPS vhost:
Code:
        location ~\.php($|/) {
...
                fastcgi_param  HTTPS on;
...


Top
Unicorn988
Post  Post subject: Re: Google reCaptcha not showing in phpbb 3 after moving from HTTP to HTTPS  |  Posted: Tue Feb 24, 2015 1:44 am

Joined: Tue Feb 24, 2015 1:22 am
Posts: 1

Offline
the virtual host serving phpbb under HTTPS. If the fastcgi_params.txt file is used for multiple virtual hosts both HTTP and HTTPS, it is best to modify your nginx server configuration only for the HTTPS vhost...??


Top
mandrei99
Post  Post subject: Re: Google reCaptcha not showing in phpbb 3 after moving from HTTP to HTTPS  |  Posted: Tue Feb 24, 2015 4:29 am

Joined: Tue Aug 04, 2009 9:16 am
Posts: 250

Offline
Unicorn988 wrote:
the virtual host serving phpbb under HTTPS. If the fastcgi_params.txt file is used for multiple virtual hosts both HTTP and HTTPS, it is best to modify your nginx server configuration only for the HTTPS vhost...??

Yes, if you don't know there will be no negative impact on the other virtual hosts.


Top
Abraham12li
Post  Post subject: Re: Google reCaptcha not showing in phpbb 3 after moving from HTTP to HTTPS  |  Posted: Sat Feb 28, 2015 8:19 am

Joined: Sat Feb 28, 2015 8:16 am
Posts: 1

Offline
this is a good post 8-)

_________________
smaert lover


Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "Google reCaptcha not showing in phpbb 3 after moving from HTTP to HTTPS"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. PHPBB-SEO sets canonical URL to http when server protocol is set to HTTPS

mandrei99

0

3013

Mon Feb 16, 2015 3:51 pm

mandrei99 View the latest post

There are no new unread posts for this topic. Google reCaptcha - An internal error occurred

mandrei99

0

13134

Thu Jan 15, 2015 9:38 pm

mandrei99 View the latest post

There are no new unread posts for this topic. Phpbb: How to list the most/least viewed topics

mandrei99

0

7030

Fri Jan 23, 2015 7:43 pm

mandrei99 View the latest post

There are no new unread posts for this topic. Php hide/remove X-Powered-By HTTP header

mandrei99

0

3201

Thu Jan 15, 2015 9:35 pm

mandrei99 View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
cronNews News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO