Skip to content

Commit

Permalink
Item14405: Honor ForceDefaultUrlHost in Foswiki::Request->url()
Browse files Browse the repository at this point in the history
Ensure that protocol sticks to https rather than depending on the status
of the Request->secure() flag, which is masked by a proxy server.
  • Loading branch information
gac410 committed May 23, 2017
1 parent a3fb8a4 commit de3aafc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/lib/Foswiki/Request.pm
Expand Up @@ -294,9 +294,16 @@ sub url {
}
$name =~ s(//+)(/)g;
if ($full) {
my $vh = $this->header('X-Forwarded-Host') || $this->header('Host');
$url =
$vh ? $this->protocol . '://' . $vh : $Foswiki::cfg{DefaultUrlHost};
if ( $Foswiki::cfg{ForceDefaultUrlHost} ) {
$url = $Foswiki::cfg{DefaultUrlHost};
}
else {
my $vh = $this->header('X-Forwarded-Host') || $this->header('Host');
$url =
$vh
? $this->protocol . '://' . $vh
: $Foswiki::cfg{DefaultUrlHost};
}
return $url if $base;
$url .= $name;
}
Expand Down

0 comments on commit de3aafc

Please sign in to comment.