Difference between revisions of "Wordpress : Run Behind Reverse Proxy"
Jump to navigation
Jump to search
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...") |
Michael.mast (talk | contribs) (→Fix) |
||
Line 6: | Line 6: | ||
==Fix== | ==Fix== | ||
− | The following fix is readily searchable on the internet.<ref>https://blog.chmouel.com/2016/09/22/the-trick-to-get-your-wordpress-behind-a-reverse-proxy/</ref> | + | The following fix is readily searchable on the internet.<ref>https://blog.chmouel.com/2016/09/22/the-trick-to-get-your-wordpress-behind-a-reverse-proxy/</ref> Add the following to wp-config.php to the BEGINNING of the file after <?php <ref>https://techblog.jeppson.org/2017/08/fix-wordpress-sorry-not-allowed-access-page/</ref>, otherwise you will get the "you do not have access to this page" error |
<pre> | <pre> | ||
if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) || | if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) || |
Latest revision as of 14:30, 24 June 2019
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] Add the following to wp-config.php to the BEGINNING of the file after <?php [2], otherwise you will get the "you do not have access to this page" error
if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) || (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) ) { $_SERVER['HTTPS'] = 'on'; }