WordPress ERR_TOO_MANY_REDIRECTS through the varnish

Basically the problem was related to wp-config. I inserted this code:

if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
   $_SERVER['HTTPS'] = 'on';
}

if ( !isset( $_SERVER['HTTPS'] ) ) {
    $_SERVER['HTTPS'] = 'on';
}

And it worked. Initially I simply tried $_SERVER[‘HTTPS’] = ‘on’;, but I received a 50x error. Not sure exactly why. On other wp installation, the simple directly did work. I’ll have to do some more tests in the future.

Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat