Hi Matt, You have to use HAProxy 1.5. You can load redirects from a map file. Map file content, 2 columns, with on the left the reference (what you're looking from in the client request) and on the right the response to send back. domain2.com subdomain.domain1.com
Then, in your frontend, simply add: http-request redirect code 302 prefix http://%[req.hdr(host),map_str(map_redirects.lst)] if { req.hdr(Host),map_str(map_redirects.lst) -m found } Content of map_redirects.lst: domain2.com subdomain.domain1.com If the domain is not listed, then HAProxy will return a 503. Here are some results: GET http://127.0.0.1:8080/ -H "Host: domain2.com" HTTP/1.1 302 Found Cache-Control: no-cache Content-length: 0 Location: http://subdomain.domain1.com/ Connection: close GET http://127.0.0.1:8080/blah -H "Host: domain2.com" HTTP/1.1 302 Found Cache-Control: no-cache Content-length: 0 Location: http://subdomain.domain1.com/blah Connection: close GET http://127.0.0.1:8080/ -H "Host: domain1.com" HTTP/1.0 503 Service Unavailable Cache-Control: no-cache Connection: close Content-Type: text/html The content of the map can be updated through the HAProxy socket or though HTTP headers. Read the manual to know how. Bear in mind HAProxy will reset its memory with the content of the file when reloading. So it's up to you to sync the memory of HAProxy and the content of the file. Baptiste On Thu, May 22, 2014 at 11:08 PM, Matt . <yamakasi....@gmail.com> wrote: > Babtiste, > > I'm not able to find any solution to add such rewrites, am I looking wrong ? > > Cheers, > > Matt > > > 2014-05-22 16:37 GMT+02:00 Matt . <yamakasi....@gmail.com>: > >> Hi, >> >> That is nice, is that in the development version ? I didn't see it in 1.4 >> as I'm right. >> >> I need to forward domain2.com to subdomain.domain1.com >> >> and subdomain.domain1.com may be a various of webservers that serve that >> content. >> >> Thanks! >> >> Matt > >