Permalink
Browse files

Item14405: Honor ForceDefaultUrlHost in Foswiki::Request->url()

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 de3aafcb8c2cdf48e2747ebabdd8f43625380215
Showing with 10 additions and 3 deletions.
  1. +10 −3 core/lib/Foswiki/Request.pm
@@ -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;
}

0 comments on commit de3aafc

Please sign in to comment.