[Catalyst-dev] [Fwd: [Catalyst] Lighttpd Proxy Support]

Jonathan Rockway jon at jrock.us
Tue Oct 10 18:53:25 CEST 2006


Can anyone confirm this?  We can't really test this until kd has his
lighty tests working properly.  (Or are they working?)

-------- Original Message --------
Subject: [Catalyst] Lighttpd Proxy Support
Date: Mon, 9 Oct 2006 18:23:19 -0400
From: Adam Herzog <adam at herzogdesigns.com>
Reply-To: The elegant MVC web framework <catalyst at lists.rawmode.org>
To: catalyst at lists.rawmode.org

I ran into a small problem when using Lighttpd to proxy to my Cat app
(running under Apache/mod_fastcgi).

Catalyst's proxy support uses the X-Forwarded-For and X-Forwarded-
Host headers to set the appropriate information about the request.
Unfortunately, Lighttpd doesn't send X-Forwarded-Host; instead it
sends X-Host. Lighttpd has had a ticket open asking to have X-
Forwarded-Host added for quite a while now, so I'm not too hopeful
that it'll get added any time soon.

So, does it make sense to have Cat check for either of these headers?
I've included a small patch which adds that support, assuming it's
sane to do so...

Thanks,
-A

Index: lib/Catalyst/Engine/CGI.pm
===================================================================
--- lib/Catalyst/Engine/CGI.pm  (revision 5057)
+++ lib/Catalyst/Engine/CGI.pm  (working copy)
@@ -128,9 +128,10 @@
              last PROXY_CHECK if $host !~ /localhost|127.0.0.1/;
              last PROXY_CHECK if $c->config->{ignore_frontend_proxy};
          }
-        last PROXY_CHECK unless $ENV{HTTP_X_FORWARDED_HOST};
+        last PROXY_CHECK
+            unless $ENV{HTTP_X_FORWARDED_HOST} || $ENV{HTTP_X_HOST};
-        $host = $ENV{HTTP_X_FORWARDED_HOST};
+        $host = $ENV{HTTP_X_FORWARDED_HOST} || $ENV{HTTP_X_HOST};
          # backend could be on any port, so
          # assume frontend is on the default port



_______________________________________________
List: Catalyst at lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;



More information about the Catalyst-dev mailing list