Hi Dorin,

On Wed, Mar 23, 2011 at 10:15:32AM -0700, Dorin Cornea wrote:
> Hey guys,
> I would like to set up HAProxy to forward HTTP requests to several backend 
> servers but I need it to also rewrite the URI part based on the Host header. 
> I've read through the doc but it seems that reqirep isn't suitable for this 
> purpose. Any idea if this is even possible with HAProxy? If it's not possible 
> using the current code can you offer any suggestions about how a code patch 
> could be developed to achieve this?
> What I'd like to set up would be to have HAProxy rewrite a request like this:
> 
> GET /original-uri HTTP/1.1
> Host: original-domain.tld
> 
> to:
> 
> GET /domains/original-domain.tld/original-uri HTTP/1.1
> Host: serverN
> 
> and forward that request to one of the internal servers. 

No, we still can't do that. We have to implement a mechanism to
extract parts of requests and reuse them at other places (basically
session-based variables) but there's nothing yet. It's in the roadmap
though.

You'll have to find another way to do it unfortunately. If you have
just a few domains, you can write a few rules (one per domain) to
perform conditional rewrites (eg: if Host matches XX, rewrite URI
as /domains/XX/original-uri).

If you have too many of them, you'd better look at another product for
the job. I think that nginx is particularly suited at these tasks.

Regards,
Willy


Reply via email to