Cannot login to WordPress Admin with SSL terminated load balancer

Question

Running WordPress 4.7.3 with a HAProxy (version 1.7.2) frontend and
Apache 2.4.10 with PHP 5.6 backend.

This is all under Debian 8.7 as well.

X-Forwarded-For and X-Forwarded-Proto are set correctly by HAProxy.

The issue I’m having is when I have SSL terminated on the HAProxy frontend (running http mode) and login to WordPress Admin I get the error

Sorry, you are not allowed to access this page.

I tried the steps from here but they didn’t fix the issue.

At the bottom of my wp-config.php I have

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';

I tried a clean install of WordPress (was importing a clients side of an earlier WordPress for spring cleaning, but that didn’t fix the issue either).

0
, jtl 2 years 2019-12-31T08:38:41-05:00 0 Answers 90 views 0

Leave an answer

Browse
Browse