Skip to content

Commit

Permalink
Honor HTTP_X_FORWARDED_PROTOCOL if set
Browse files Browse the repository at this point in the history
  • Loading branch information
ambs committed Jun 10, 2011
1 parent 21060c3 commit 9a3a6d9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Dancer/Request.pm
Expand Up @@ -55,9 +55,15 @@ sub script_name { $_[0]->env->{SCRIPT_NAME} }
sub scheme {
my $scheme;
if (setting('behind_proxy')) {
$scheme = $_[0]->env->{'X_FORWARDED_PROTOCOL'} || $_[0]->env->{'HTTP_FORWARDED_PROTO'} || ""
$scheme = $_[0]->env->{'X_FORWARDED_PROTOCOL'}
|| $_[0]->env->{'HTTP_X_FORWARDED_PROTOCOL'}
|| $_[0]->env->{'HTTP_FORWARDED_PROTO'}
|| ""
}
return $scheme || $_[0]->env->{'psgi.url_scheme'} || $_[0]->env->{'PSGI.URL_SCHEME'} || "";
return $scheme
|| $_[0]->env->{'psgi.url_scheme'}
|| $_[0]->env->{'PSGI.URL_SCHEME'}
|| "";
}
sub secure { $_[0]->scheme eq 'https' }
sub uri { $_[0]->request_uri }
Expand Down

0 comments on commit 9a3a6d9

Please sign in to comment.