[dancer-users] Behind proxy sometimes

Matthew Mallard mqm at Q-Technologies.com.au
Wed May 14 22:27:04 BST 2014


Hi,

Long story, but I’m using a config where I’m connecting to the Plackup instance through an SSH tunnel.  The users I’m developing for will connect through an Apache reverse proxy to the same environment.  Anyhow, the behind_proxy setting was causing my SSH tunnel session to barf on splitting an uninitialised variable.  This fixes it - should be harmless to put in for everyone, but a bit safer for the fringe cases:

--- /perf/perl/lib/perl5/Dancer2/Core/Request.pm	2014-05-12 14:23:07.000000000 +1000
+++ /perf/perl/lib/perl5/Dancer2/Core/Request.pm.bak	2014-05-12 14:26:28.049744396 +1000
@@ -222,7 +222,7 @@
 sub host {
     my ($self) = @_;

-    if ( $self->is_behind_proxy && $self->env->{HTTP_X_FORWARDED_HOST} ) {
+    if ( $self->is_behind_proxy ) {
         my @hosts = split /\s*,\s*/, $self->env->{HTTP_X_FORWARDED_HOST}, 2;
         return $hosts[0];
     } else {


Regards,
Matt








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20140515/26dc96fc/attachment.html>


More information about the dancer-users mailing list