[Catalyst] Making proxy requests cooperate with uri_for

Ashley apv at sedition.com
Mon Oct 20 20:23:38 BST 2008


This might be a simple question but I've never had to do it before,  
Googling for it is difficult, and none of the main docs seems to have  
the info.

I want to run myapp_server.pl script as a proxy as if it were from a  
dir.

This is easily accomplished with

     ProxyPass /from_dir http://localhost:8080/
     ProxyPassReverse /from_dir http://localhost:8080/

The problem then is $c->uri_for("/") returns http://localhost/ when  
http://localhost/from_dir is what is really needed.

This message seemed like the right answer
   http://lists.scsys.co.uk/pipermail/catalyst/2007-December/016241.html
but it doesn't work (Apache 2.2); uri_for() is still not adjusted to  
include the desired proxy path.

    RewriteEngine     On
    RewriteRule       ^/from_dir/(.*$)  http://localhost:8080/$1  [P]
    ProxyPassReverse  /from_dir/  http://localhost:8080/
    RewriteRule       ^proxy:.* - [F]

I played around with setting the (apparently?) undocumented  
"using_frontend_proxy" in the App config too but no dice.

What am I doing wrong / how can I get uri_for() to behave?

Thanks!
-Ashley



More information about the Catalyst mailing list