Skip Menu |

This queue is for tickets about the Catalyst-Runtime CPAN distribution.

Report information
The Basics
Id: 28649
Status: resolved
Priority: 0/
Queue: Catalyst-Runtime

People
Owner: Nobody in particular
Requestors: duncan_j_ferguson [...] yahoo.co.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 5.7007
Fixed in: (no value)



Subject: Catalyst::Engine::CGI and HTTP don't honour X-Forwarded-Host
When using the dev server (CGI/HTTP engine) X-Forwarded-Host ports are not honoured. Attached is a patch to fix.
Subject: catalyst_runtime_cgi_port_forwarding.patch
diff -ur Catalyst-Runtime-5.7007.orig/lib/Catalyst/Engine/CGI.pm Catalyst-Runtime-5.7007/lib/Catalyst/Engine/CGI.pm --- Catalyst-Runtime-5.7007.orig/lib/Catalyst/Engine/CGI.pm 2007-03-13 09:28:23.000000000 +0000 +++ Catalyst-Runtime-5.7007/lib/Catalyst/Engine/CGI.pm 2007-08-03 17:03:27.000000000 +0100 @@ -132,9 +132,14 @@ $host = $ENV{HTTP_X_FORWARDED_HOST}; - # backend could be on any port, so - # assume frontend is on the default port - $port = $c->request->secure ? 443 : 80; + if ( $host =~ /^(.+):(\d+)$/ ) { + $host = $1; + $port = $2; + } else { + # backend could be on any port, so + # assume frontend is on the default port + $port = $c->request->secure ? 443 : 80; + } } # set the base URI diff -ur Catalyst-Runtime-5.7007.orig/lib/Catalyst/Engine/HTTP.pm Catalyst-Runtime-5.7007/lib/Catalyst/Engine/HTTP.pm --- Catalyst-Runtime-5.7007.orig/lib/Catalyst/Engine/HTTP.pm 2007-03-13 13:17:56.000000000 +0000 +++ Catalyst-Runtime-5.7007/lib/Catalyst/Engine/HTTP.pm 2007-05-15 12:37:14.000000000 +0100 @@ -277,6 +277,10 @@ if ( my $error = delete $self->{_write_error} ) { DEBUG && warn "Write error: $error\n"; close Remote; + if(defined $pid) { + $daemon->close; + exit; + } next LISTEN; }
Subject: Re: [rt.cpan.org #28649] AutoReply: Catalyst::Engine::CGI and HTTP don't honour X-Forwarded-Host
Date: Fri, 3 Aug 2007 17:21:44 +0100
To: bug-Catalyst-Runtime [...] rt.cpan.org
From: Duncan Ferguson <duncan_j_ferguson [...] yahoo.co.uk>
Please note the attached patch also includes a previously submitted and applied patch by mistake (against Catalyst/Engine/HTTP.pm) On 3 Aug 2007, at 17:15, Bugs in Catalyst-Runtime via RT wrote: Show quoted text
> > Greetings, > > This message has been automatically generated in response to the > creation of a trouble ticket regarding: > "Catalyst::Engine::CGI and HTTP don't honour X-Forwarded-Host", > a summary of which appears below. > > There is no need to reply to this message right now. Your ticket > has been > assigned an ID of [rt.cpan.org #28649]. Your ticket is accessible > on the web at: > > http://rt.cpan.org/Ticket/Display.html?id=28649 > > Please include the string: > > [rt.cpan.org #28649] > > in the subject line of all future correspondence about this issue. > To do so, > you may reply to this message. > > Thank you, > bug-Catalyst-Runtime@rt.cpan.org > > ---------------------------------------------------------------------- > --- > When using the dev server (CGI/HTTP engine) X-Forwarded-Host ports are > not honoured. > > Attached is a patch to fix.
-- Duncan Ferguson Opsview - Making Nagios Easier http://www.altinity.com Tel: +44 (0)870 787 9243 Fax: +44 (0)845 280 1725 Skype: duncan_j_ferguson MSN: duncan.ferguson@altinity.com
From: AGRUNDMA [...] cpan.org
OK we have a big patch coming soon that makes a lot of changes to the proxy and X-* handling, so I think we'll finally get it right. :) It's in a branch right now: http://dev.catalystframework.org/svnweb/Catalyst/browse/branches/Catalyst-Runtime-proxystuff/
Sorry, we've entirely pushed this off to Plack. See Catalyst::PSGI.