[Catalyst] Reverse Proxy setup,
base address and placing a CatApp on a subdir
Pedro Melo
melo at simplicidade.org
Thu Nov 9 19:04:19 GMT 2006
Hi,
I've have a solution for a problem I have and I wonder if there is a
better way.
I have an existing site, and I want to add a Catalyst-based app in a
subdirectory, for example /app.
The setup I've been trying is this:
1. setup a reverse proxy in the main site. With apache, something
like this works:
<IfModule mod_proxy.c>
ProxyRequests Off
ProxyPass /app http://127.0.0.1:3000/
ProxyPassReverse /app http://127.0.0.1:3000/
</IfModule>
(i'm testing with the builtin server, production would use other
setup, of course).
2. right now, the setup works, but redirects (for example) fail
miserably because a redirect inside Cat to /something will go to
http://main.site/something, instead of http://main.site/app/something.
3. I've looked at the header's sent by apache and I could not find
anything that would tell me that the reverse proxy is re-proxyng /app
and not /, so I used this in my App::C::Root:
sub auto : Private {
my ($self, $c) = @_;
my $uri = $c->req->base;
$uri->path('/app');
$c->req->base($uri);
}
This works, or so far in my tests, seems to work. I could also move
the "/app" bit to the configuration file, but I don't see a way out
of messing with $c->req->base in my code.
Correct? Or am I missing something terribly obvious?
Best regards,
--
Pedro Melo
JID: xmpp:melo at simplicidade.org
More information about the Catalyst
mailing list