Last active
October 8, 2022 17:41
-
-
Save amanjuman/b5b18108176f9158778d112dff648922 to your computer and use it in GitHub Desktop.
WordPress Config for Server Behild Load Balancer or Argo Tunnel
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
// Define WordPress URLS | |
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/'); | |
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/'); | |
// HTTPS Forward (If orgin is HTTP Only) | |
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') | |
$_SERVER['HTTPS'] = 'on'; | |
// Dynamic Host Name | |
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { | |
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST']; | |
} | |
// This one also works | |
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) | |
$_SERVER['HTTPS']='on'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment