Skip to content

Instantly share code, notes, and snippets.

@amanjuman
Last active October 8, 2022 17:41
Show Gist options
  • Save amanjuman/b5b18108176f9158778d112dff648922 to your computer and use it in GitHub Desktop.
Save amanjuman/b5b18108176f9158778d112dff648922 to your computer and use it in GitHub Desktop.
WordPress Config for Server Behild Load Balancer or Argo Tunnel
// 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