[Dancer-users] working with HTTP env vars

Daniel Pittman daniel at rimspace.net
Fri Aug 20 05:22:38 CEST 2010


P Kishor <punk.kish at gmail.com> writes:
> On Thu, Aug 19, 2010 at 8:02 PM, Olaf Alders <olaf at wundersolutions.com> wrote:
>> On 2010-08-19, at 8:52 PM, P Kishor wrote:

[...]

> Thanks a ton for holding my hand. I figured out a solution for my
> dilemma. First, basically, as far as Apache is concerned, the proxied
> request is as if it were made directly. In other words, if I have the
> following
>
>     ProxyPass /app/foo http://foo.org
>
> Apache thinks I have actually called http://foo.org directly when I
> actually go to http://mywebsite/app/foo.

...which, indeed, you just did.  The fact that your proxy passes the content
and some headers back to the originator is invisible to the endpoints.

To address this you have a handful of choices:

You can, if you have a sufficiently recent Apache, use the HTML/XML rewriting
module that works in conjunction with the proxy to rewrite URL paths on the
way out in the body, not just the headers.

You can make your back-end server use the same paths as the front-end server,
so that the environment is uniform.

You can use a protocol like FastCGI rather than HTTP between your front-end
server and your application server.  Since that does preserve, and pass, the
original path details where HTTP doesn't your back-end will get what you want.


In our company we use the later two options, but prefer the FastCGI approach.
Having that listen via TCP works great, and it also opens the door to later
using a lighter weight server than Apache at the front end.

Regards,
        Daniel
-- 
✣ Daniel Pittman            ✉ daniel at rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons


More information about the Dancer-users mailing list