Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Apache proxies to a PSGI application using HTTP::Server::PSGI.

apache conf file:

<Proxy balancer://my_cluster>
   BalancerMember http://127.0.0.1:3001
   BalancerMember http://127.0.0.1:3002
   BalancerMember http://127.0.0.1:3003
</Proxy>

ProxyPreserveHost On
ProxyPass /dispatch/ balancer://my_cluster/

The url is going to be: http://foo.com/dispatch/main

after calling $self->query->self_url() I get: http://foo.com/main

/dispatch is cut out every time. I'm not sure what layer is cutting it out or how to get it back.

share|improve this question
    
Does your PSGI app use the ReverseProxy middleware? –  hobbs May 26 '11 at 20:59
    
No. Should it? (15 char comment min?) –  nathand May 26 '11 at 21:19
    
turned out to be a red herring, per discussion in #plack. Ideally, Middleware::ReverseProxy would help with this, but there's no "forwarded path" information, so it actually doesn't :) –  hobbs May 26 '11 at 21:23

1 Answer 1

up vote 2 down vote accepted

First I needed to set ProxyPreserveHost Off (which is the default)

Change the entry point for the PSGI app.

builder {
   return $app;
}

becomes:

builder {
   mount "/dispatch" => $app
}

change the ProxyPass to:

ProxyPass /dispatch/ balancer://my_cluster/dispatch/

Now url_self() works as expected.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.