File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -89,12 +89,22 @@ public static function getCurrentUrl($requestUri = false)
89
89
$ protocol = 'http:// ' ;
90
90
91
91
if (($ collection ->get ('HTTPS ' ) && $ collection ->get ('HTTPS ' ) !== 'off ' ) ||
92
- $ collection ->get ('HTTP_X_FORWARDED_PROTO ' ) === ' https ' ) {
92
+ self :: isXForwardedProtoHttps ( $ collection ->get ('HTTP_X_FORWARDED_PROTO ' )) ) {
93
93
$ protocol = 'https:// ' ;
94
94
}
95
95
96
96
return $ protocol .
97
97
$ collection ->get ('HTTP_HOST ' ) .
98
98
$ collection ->get ($ requestUri ? 'REQUEST_URI ' : 'PHP_SELF ' );
99
99
}
100
+
101
+ public static function isXForwardedProtoHttps ($ xForwardedProto )
102
+ {
103
+ $ protos = explode (', ' , (string )$ xForwardedProto );
104
+ if (count ($ protos ) > 0 ) {
105
+ return trim ($ protos [0 ]) === 'https ' ;
106
+ }
107
+
108
+ return false ;
109
+ }
100
110
}
Original file line number Diff line number Diff line change 11
11
12
12
use Hybridauth \Exception \Exception ;
13
13
use Hybridauth \Exception \ExceptionInterface ;
14
+ use Hybridauth \HttpClient \Util ;
14
15
15
16
/**
16
17
* Class ErrorException
@@ -255,7 +256,7 @@ protected function get_realm_protocol()
255
256
if (!empty ($ _SERVER ['HTTPS ' ])) {
256
257
$ use_secure_protocol = ($ _SERVER ['HTTPS ' ] !== 'off ' );
257
258
} elseif (isset ($ _SERVER ['HTTP_X_FORWARDED_PROTO ' ])) {
258
- $ use_secure_protocol = ($ _SERVER ['HTTP_X_FORWARDED_PROTO ' ] == ' https ' );
259
+ $ use_secure_protocol = (Util:: isXForwardedProtoHttps ( $ _SERVER ['HTTP_X_FORWARDED_PROTO ' ]) );
259
260
} elseif (isset ($ _SERVER ['HTTP__WSSC ' ])) {
260
261
$ use_secure_protocol = ($ _SERVER ['HTTP__WSSC ' ] == 'https ' );
261
262
} else {
You can’t perform that action at this time.
0 commit comments