1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

Merge pull request #4182 from marc1706/ticket/14481

[ticket/14481] Respect HTTP_X_FORWARDED headers for implying https

* marc1706/ticket/14481:
  [ticket/14481] Add tests for x_forwarded_proto header
  [ticket/14481] Use port 443 if https is specified in x-forwarded-proto
  [ticket/14481] Respect HTTP_X_FORWARDED headers for implying https
This commit is contained in:
Tristan Darricau
2016-03-27 12:56:03 +02:00
5 changed files with 126 additions and 6 deletions

View File

@@ -2234,6 +2234,12 @@ function generate_board_url($without_script_path = false)
$server_name = $user->host;
$server_port = $request->server('SERVER_PORT', 0);
$forwarded_proto = $request->server('HTTP_X_FORWARDED_PROTO');
if (!empty($forwarded_proto) && $forwarded_proto === 'https')
{
$server_port = 443;
}
// Forcing server vars is the only way to specify/override the protocol
if ($config['force_server_vars'] || !$server_name)