Created
March 28, 2017 12:10
-
-
Save 4ley/8de19a5c1c01a43edd3f3a4143bafcac to your computer and use it in GitHub Desktop.
WordPress / Apache / Reverse Proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost ...> | |
... | |
# Reverse Proxy | |
ProxyRequests Off | |
#ProxyPreserveHost On | |
RequestHeader set X-Forwarded-Proto "https" | |
ProxyPass /blog http://blog.example.org/blog | |
ProxyPassReverse /blog http://blog.example.org/blog | |
... | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Reverse Proxy | |
*/ | |
define('WP_HOME', 'https://www.example.org/blog'); | |
define('WP_SITEURL', 'https://www.example.org/blog'); | |
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { | |
$_SERVER['HTTPS'] = 'on'; | |
$_SERVER['REQUEST_SCHEME'] = 'https'; | |
} | |
if ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) { | |
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
} | |
if ( ! empty( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) { | |
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment