0

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
micah
  • 7,596
  • 10
  • 49
  • 90
  • I've never setup WordPress behind a load balancer, but WordPress errors get logged to the PHP error logs. [This question](https://stackoverflow.com/questions/8955411/find-out-the-error-logs-path) shows you how to find the location of the error log – hostingutilities.com Aug 09 '20 at 04:50
  • Thanks. I figured it out and updated my question. – micah Aug 09 '20 at 04:58
  • For locating the PHP error log, the canonical is *[Where does PHP store the error log? (PHP 5, Apache, FastCGI, and cPanel)](https://stackoverflow.com/questions/5127838/)* (despite the over-specific title). – Peter Mortensen Sep 26 '21 at 13:55

0 Answers0