0

I have a WordPress site that I am trying to set up with SSL. The site is working except for the admin dashboard, which results in this error in Chrome:

ERR_TOO_MANY_REDIRECTS

I found a post on StackOverflow that helped with the HTTPS redirect, since Heroku apparently does things a bit differently. Nonetheless, I'm still stuck with the error.

I've added this to my wp-config.php file, with no luck:

define('FORCE_SSL_ADMIN', true);

My .htaccess file looks like:

# BEGIN s2Member GZIP exclusions
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]
    RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1
    RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions


#https://stackoverflow.com/questions/26489519/how-to-redirect-to-https-with-htaccess-on-heroku-cedar-stack/26494983#26494983
<IfModule mod_rewrite.c>
##Force SSL 
#Normal way (in case you need to deploy to NON-heroku)
RewriteCond %{HTTPS} !=on

#Heroku way
RewriteCond %{HTTP:X-Forwarded-Proto} !https 

#If neither above conditions are met, redirect to https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

When I run curl --verbose --head --location ,

I see that it is redirecting back and forth from http://easyofficepools.herokuapp.com and https://easyofficepools.herokuapp.com. I'm not sure where the http redirect is coming from.

Any ideas would be much appreciated!

EDIT: I also noticed that the PINGBACK info from curl is http ,and not https:

< X-Pingback: http://easyofficepools.herokuapp.com/xmlrpc.php
X-Pingback: http://easyofficepools.herokuapp.com/xmlrpc.php
ZenPylon
  • 518
  • 4
  • 11

1 Answers1

1

Looks like this was a duplicate (alas, one that eluded me for 2 hours)!

https://wordpress.stackexchange.com/questions/170165/wordpress-wp-admin-https-redirect-loop

I needed to add this to my wp-config.php:

/** SSL */  
define('FORCE_SSL_ADMIN', true);  
// in some setups HTTP_X_FORWARDED_PROTO might contain  
// a comma-separated list e.g. http,https  
// so check for https existence  
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)  
    $_SERVER['HTTPS']='on';
Community
  • 1
  • 1
ZenPylon
  • 518
  • 4
  • 11