[Catalyst] working with strange port setups

Darren Duncan darren at darrenduncan.net
Sat Aug 21 09:51:20 GMT 2010


Hello,

For context, I'm currently deploying/demoing a Catalyst app on a client machine 
where it uses a contrived base url scheme to work around a restrictive firewall 
setup.  To be specific, the Firewall blocks all ports except port 80 (plus a few 
admin ports like SSH etc) and I want to run through HTTPS, so I've currently got 
the machine's Apache running HTTPS through port 80 rather than 443.

(My development machine isn't contrived at all, so no issue there.)

The contrived url for my Catalyst app looks like this:

   https://example.com:80/MyApp/some/page

My app initially works fine here using the FastCGI or CGI server script and the 
urls produced by uri_for() are mostly what is needed here but not quite.

An invocation of:

   https://example.com:80/MyApp/some/page

... would have page urls going to the likes of:

   https://example.com/MyApp/other/page

... which is correct except for the missing :80, because the result alone 
implies port 443 which isn't correct here.

Now from running the first url with "?dump_info=1" shows that the FastCGI/CGI 
program, namely Catalyst, *does* receive the necessary information to produce 
correct base urls.

Here's a relevant subset of "Request" details from dump_info:

bless({
   base => bless(do{\(my $o = "https://example.com/MyApp/")}, "URI::https"),
   headers => bless({
                         "host" => "example.com:80",
                         "https" => "on",
                       }, "HTTP::Headers"),
   uri => bless(do{\(my $o = 
"https://example.com/MyApp/some/page?dump_info=1")}, "URI::https"),
}, "Catalyst::Request")

The "base" and "uri" reflect the incorrect output, but the "headers" records the 
fact that both port 80 was invoked and https is on.  Using the latter 2 bits of 
information, Catalyst should be able to construct "https://example.com:80" urls.

Therefore, can anyone tell me how to configure Catalyst so that it builds the 
urls I need, or alternately where in the Catalyst source I should look in order 
to create a patch to enable this?

Ideally this added smarts could make it into a CPAN release, if code changes are 
needed, but I would like to have this working quite soon, so if I knew what to 
patch in the meantime to get this to work, I would appreciate it.

Undoubtedly, Catalyst should simply handle this situation, but I'm not surprised 
that it doesn't yet, considering this is an edge case that the developers may 
not have encountered before.

Thank you. -- Darren Duncan



More information about the Catalyst mailing list