File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,11 @@ public function __toString(): string
67
67
68
68
private function autoDetectUrl (): string
69
69
{
70
- $ https = isset ($ _SERVER ['HTTPS ' ]) ? strtolower ($ _SERVER ['HTTPS ' ]) : null ;
71
- $ scheme = !empty ($ https ) && $ https != 'off ' ? 'https ' : 'http ' ;
72
- $ host = $ _SERVER ['HTTP_HOST ' ] ?? ($ _SERVER ['SERVER_NAME ' ] ?? 'localhost ' );
70
+ $ https = isset ($ _SERVER ['HTTPS ' ]) ? strtolower ($ _SERVER ['HTTPS ' ]) : null ;
71
+ $ httpsForwarded = isset ($ _SERVER ['HTTP_X_FORWARDED_PROTO ' ]) ? strtolower ($ _SERVER ['HTTP_X_FORWARDED_PROTO ' ]) : null ;
73
72
74
- if (empty ($ host )) {
75
- throw new \RuntimeException ('Could not detect hostname, please specify the url in your config ' );
76
- }
73
+ $ scheme = $ https === 'on ' || $ httpsForwarded === 'https ' ? 'https ' : 'http ' ;
74
+ $ host = $ _SERVER ['HTTP_HOST ' ] ?? ($ _SERVER ['SERVER_NAME ' ] ?? 'localhost ' );
77
75
78
76
return $ scheme . ':// ' . $ host ;
79
77
}
You can’t perform that action at this time.
0 commit comments