Created
February 13, 2017 15:21
-
-
Save buchizo/1b619c5461295822f0c45e666ba716bf to your computer and use it in GitHub Desktop.
WordPress on Azure App Service via nginx (require any X-FORWARDED headers)
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
if ( array_key_exists( "HTTP_X_FORWARDED_SERVER", $_SERVER ) ) { | |
if ( ! empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) { | |
$_SERVER['HTTPS']='on'; | |
} | |
define( "WP_SITEURL", "http://" . $_SERVER["HTTP_X_FORWARDED_SERVER"] ); | |
define( "WP_HOME", "http://" . $_SERVER["HTTP_X_FORWARDED_SERVER"] ); | |
$_SERVER['HTTP_HOST'] = $_SERVER["HTTP_X_FORWARDED_SERVER"]; | |
$_SERVER['SERVER_NAME'] = $_SERVER["HTTP_X_FORWARDED_SERVER"]; | |
} else { | |
define( "WP_SITEURL", "http://yoursite.azurewebsites.net" ); | |
define( "WP_HOME", "http://yoursite.azurewebsites.net" ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment