[Dancer-users] deployment problems with apache + starman
Assaf Gordon
gordon at cshl.edu
Mon Nov 7 19:59:16 CET 2011
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.
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
More information about the Dancer-users
mailing list