[Dancer-users] deployment problems with apache + starman

Alex Knowles alexk at moonfruit.com
Tue Nov 8 17:37:03 CET 2011

On Mon, 2011-11-07 at 18:59 +0000, Assaf Gordon wrote:
> Eureka! 
> Alex Knowles wrote, On 11/07/11 13:04:
> > 
> > There's a behind_proxy setting in config which is probably exactly for
> > this situation:
> > 
> > http://search.cpan.org/~xsawyerx/Dancer-1.3080/lib/Dancer/Config.pm#behind_proxy_%28boolean%29
> > 
> Thanks Alex, "behind_proxy" is indeed *almost* the solution.
> I found it by looking at the code (it is *not* mentioned anywhere in Dancer::Deployment), but still couldn't get it to work properly, until now.
> The problem is that for some reason, the apache headers are listed in "request->env" as HTTP_X_FORWARDED_HOST instead of "X_FORWARDED_HOST".
> Not sure if this is a problem with my apache configuration, or PSGI/Plack program or something else.
> But because of that, "behind_proxy" was not working.

oh awesome!  Sorry, I was in a bit of a rush when I wrote my reply.

We had exactly this problem, specifically for proxying ssl content (yay!
security!).  However we're running a little behind on dancer version so
were missing the behind_proxy setting, we did a bump and it didn't work,
so just set the apache preserve stuff.

But it's handy to know it's not just us :)


> I've added a patch that fixes the "behind_proxy" in this situation, but also warns if "behind_proxy" is defined and the X_FORWARDED_HOST is not found - because this case should not be just ignored.
> https://github.com/agordon/Dancer/commit/5b0e9562acacaee18fd6519c32c9d33f8c202a59
> With this patch, I'm able to solve all my previous deployment questions:
> 1. Multiple dancer applications under one server
> 2. Multiple dancer applications not under the root directory
> 3. Serve static files directly with apache (not through dancer)
> So if you please agree to include this patch, I'll be happy to change (improve?) the deployment pod with more examples.
> regards,
>  -gordon
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users

More information about the Dancer-users mailing list