Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress / Apache / Reverse Proxy
<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>
/**
* 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
You can’t perform that action at this time.