diff --git a/src/OAuth/OAuthRequest.php b/src/OAuth/OAuthRequest.php index b7498f8..34983f2 100644 --- a/src/OAuth/OAuthRequest.php +++ b/src/OAuth/OAuthRequest.php @@ -38,10 +38,15 @@ public static function from_request($http_method = null, $http_url = null, $para $scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") ? 'http' : 'https'; + $port = $_SERVER['SERVER_PORT']; + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && isset($_SERVER['HTTP_X_FORWARDED_PORT'])) { + $scheme = $_SERVER['HTTP_X_FORWARDED_PROTO']; + $port = $_SERVER['HTTP_X_FORWARDED_PORT']; + } $http_url = ($http_url) ? $http_url : $scheme . '://' . $_SERVER['SERVER_NAME'] . ':' . - $_SERVER['SERVER_PORT'] . + $port . $_SERVER['REQUEST_URI']; $http_method = ($http_method) ? $http_method : $_SERVER['REQUEST_METHOD'];