Skip to content

Instantly share code, notes, and snippets.

@hiraq
Last active December 17, 2015 17:19
Show Gist options
  • Save hiraq/5645211 to your computer and use it in GitHub Desktop.
Save hiraq/5645211 to your computer and use it in GitHub Desktop.
fix error redirect by referer, when running on proxy server (HTTP_X_FORWARDED_HOST has been set)
<?php
/*
* fix redirect because proxy server
*/
if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$_SERVER['HTTP_X_FORWARDED_HOST'] = isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
}
@hiraq
Copy link
Author

hiraq commented May 25, 2013

ah, you're right, your solution look better for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment