Wordpress wp-admin behind HAproxy

This code has to be on top of the wp-config.php file right after the <?php tag. If it is somewhere in the file it doesn’t work.

/** Make sure WordPress understands it's behind an SSL terminator */ define('FORCE_SSL_ADMIN', true); define('FORCE_SSL_LOGIN', true); if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';

Source:

https://wordpress.stackexchange.com/questions/287532/https-leads-to-sorry-you-are-not-allowed-to-access-this-page