Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update Plack's method of canonicalizing the hostname

  • Loading branch information...
commit 47edced3ee5271bcbdc7c67d7519dcc38c4c1fd2 1 parent abe2d10
@ctfliblime ctfliblime authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 Koha/Plack/Util.pm
View
12 Koha/Plack/Util.pm
@@ -4,8 +4,16 @@ use Koha;
sub GetCanonicalHostname {
my $env = shift;
- my ($hostname) = split(/, /, $env->{HTTP_X_FORWARDED_HOST}//$env->{HTTP_HOST});
- $hostname //= $env->{SERVER_NAME};
+
+ my $hostname
+ = $env->{HTTP_X_FORWARDED_HOST}
+ // $env->{HTTP_X_FORWARDED_SERVER}
+ // $env->{HTTP_HOST}
+ // $env->{SERVER_NAME}
+ // 'koha-opac.default';
+ $hostname = (split qr{,}, $hostname)[0];
+ $hostname =~ s/:.*//;
+
return $hostname;
}
Please sign in to comment.
Something went wrong with that request. Please try again.