[Dancer-users] Config Setting "behind_proxy: true" gives incorrect proxied protocol

David Precious davidp at preshweb.co.uk
Thu Apr 5 10:52:40 CEST 2012


On Wed, 4 Apr 2012 17:56:34 -0700
Gurunandan Bhat <gbhat at pobox.com> wrote:

> Hi,
> 
> I am hosting a Dancer Web Application behind an Apache proxy using the
> recommended (in Dance::Deployment) configuration.
> 
> The application can be accessed via a secure URL:
> https://some.domain.comand I have set 'behind_proxy: "true"' in my
> config.yml. However when I use
> [% request.uri_base %], I get http://some.domain.com and not
> https://some.domain.com which is what I am expecting.
> 
> Is there a way to have request.uri_base return the correct proxied
> protocol (in this case https) rather than 'http'?

The following environment vars will be consulted to find out the
protocol used for the original request, in order:

 73         $scheme = $_[0]->env->{'X_FORWARDED_PROTOCOL'}
 74                || $_[0]->env->{'HTTP_X_FORWARDED_PROTOCOL'}
 75                || $_[0]->env->{'HTTP_FORWARDED_PROTO'}

If none of them are being set by Apache, that explains why it's not
working for you.

Can you dump out request->env and see what's being passed by
Apache?




-- 
David Precious ("bigpresh") <davidp at preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github


More information about the Dancer-users mailing list