Great work.  I was looking into this yesterday.   I'm glad you beat me
to it. :-)

To follow up on Tomas' comment - Why not make the override_base_uri /
override_base_uri_secure include the schema?  So if you want the URI's
to include https:// even if the request is coming in not-secure, you
can do that.

Without this functionality it would be hard to do SSL accelerators and
such properly.

I'd also love a way to callback from uri_for - but that's another
story and issue altogether.

Jay

On Oct 9, 2008, at 6:33 PM, Andrew Rodland wrote:

<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,
Andrew
<override-base-
uri.diff>_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/


_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to