I have a WordPress site that is behind a load balancer. The load balancer terminates the HTTPS connection. The site itself serves HTTP and relies on the balancer to terminate.
The problem is all links on the main site and admin are pointed to plain HTTP resources. This results in the browser blocking all styles/scripts.
Adding <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
header does not help, and even if it did it wouldn't fix the problem with the admin.
I tried updating the WP_SITEURL
and WP_HOME
in wp-config.php
, but that just causes the site to not load entirely. I have no idea where WordPress logs go...
How can I make WordPress work behind a balancer that terminates?
I figured it out. I added
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = 443;
to the top of file wp-config.php
.