Wordpress : Run Behind Reverse Proxy

From Michael's Information Zone
Revision as of 11:11, 24 June 2019 by Michael.mast (talk | contribs) (Created page with "==Purpose== To run Wordpress from a docker container on a private subnet, while proxying public access through an Apache proxy. ==Problem== Though the proxy would serve conte...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose

To run Wordpress from a docker container on a private subnet, while proxying public access through an Apache proxy.

Problem

Though the proxy would serve content over TLS, wordpress and the internal container would not. This would result in missing content because the java script scripts would not be allowed to run.

Fix

The following fix is readily searchable on the internet.[1] Append the following to wp-config.php

if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) ||
     (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) ) {
    $_SERVER['HTTPS'] = 'on';
}