Skip to content

Instantly share code, notes, and snippets.

@jacobovidal
Last active July 12, 2017 18:33
Show Gist options
  • Save jacobovidal/3a45caad1179b055ba35a9186ec6ec00 to your computer and use it in GitHub Desktop.
Save jacobovidal/3a45caad1179b055ba35a9186ec6ec00 to your computer and use it in GitHub Desktop.
Add this snippet to wp-config.php to set up HTTPS/SSL in WordPress behind a proxy
<VirtualHost *:443>
# ...
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
# ...
</VirtualHost>
<?php
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
$_SERVER['REQUEST_SCHEME'] = 'https';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment