[Catalyst] [PATCH] [RFC] Override base URI

Andrew Rodland arodland at comcast.net
Fri Oct 10 01:33:52 BST 2008

<mst> I've put something like that in a sub prepare before now
<mst> we should maybe have a config option to override base
<mst> patches would be welcome :)

Here's an attempt. I've never really hacked on the core before, so please go 
easy. Also I know that POD isn't included, but that's because I can't figure 
out where it belongs. I'll write it, given a place to put it.

Anyway, this is a patch to create a pair of config keys tell 
Engine::CGI "ignore what the server thinks the base path is, and use these 
instead". It's useful in the case that someone has their application 
port-forwarded, load-balanced, proxied, etc. through some sort of device that 
doesn't set X-Forwarded-Host.

How it works: If no config is provided, life continues as it always has. If 
the request is HTTP and $c->config->{override_base_uri} is set, we use that 
as $c->req->base. If the request is HTTPS and 
$c->config->{override_base_uri_secure} is set, we use that as $c->req->base. 
If the request is HTTPS and override_base_uri_secure isn't set, but 
override_base_uri is, we use override_base_uri and switch its scheme to https 
(hopefully it doesn't have a port).

Patch against Catalyst-Runtime/5.80/trunk which I hope is the right thing.

Comments appreciated,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: override-base-uri.diff
Type: text/x-diff
Size: 3254 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20081009/7ed85dc1/override-base-uri.bin

More information about the Catalyst mailing list