Re: reqrep with a match/backref into Host: header?

2014-03-05 Thread Willy Tarreau
On Fri, Feb 28, 2014 at 01:54:52PM +0100, Baptiste wrote:
 Hi Philipp,
 
 You can't do this in current HAProxy.
 That said, it may happen soon, since the you can already use some
 header values in the http-request rules:
 IE:
 http-request redirect code 301 location www.%[hdr(host)]%[req.uri]
 unless { hdr_beg(host) -i www }
 
 Note: I tried to use this syntax with reqirep and it does not work ;)

This syntax is only supported by http-request rules. It ensures that we
don't break existing setups (especially because since version 1.1, there
have been a huge amount of req* and rsp* rules deployed).

We'll likely add new actions later for http-request (eg: rewrite) to
support this new syntax.

Willy




reqrep with a match/backref into Host: header?

2014-02-28 Thread Philipp

Hi,

current functional setup:
frontend f
acl ssfc_dev hdr(host) -m str dev.example.com
acl ssfc_img hdr(host) -m str img.example.com
[..]
reqrep ^GET[\ \t]*/(.*) GET\ /dev.example.com/\1 if ssfc_dev
reqrep ^GET[\ \t]*/(.*) GET\ /img.example.com/\1 if ssfc_img

the backend webserver treats that accordingly.
So far so good.. but given that this list will grow over time, it'll be 
a bit of a pain to manage this.


Is there any way to make that happen by dynamic matches instead of a 
1:1 acl/reqrep pairing?
Generating such a config isnt that much of a problem, but it lacks 
elegancy in my eyes ;-)


TIA



Re: reqrep with a match/backref into Host: header?

2014-02-28 Thread Baptiste
Hi Philipp,

You can't do this in current HAProxy.
That said, it may happen soon, since the you can already use some
header values in the http-request rules:
IE:
http-request redirect code 301 location www.%[hdr(host)]%[req.uri]
unless { hdr_beg(host) -i www }

Note: I tried to use this syntax with reqirep and it does not work ;)

Baptiste

On Fri, Feb 28, 2014 at 12:35 PM, Philipp
e1c1bac6253dc54a1e89ddc046585...@posteo.net wrote:
 Hi,

 current functional setup:
 frontend f
 acl ssfc_dev hdr(host) -m str dev.example.com
 acl ssfc_img hdr(host) -m str img.example.com
 [..]
 reqrep ^GET[\ \t]*/(.*) GET\ /dev.example.com/\1 if ssfc_dev
 reqrep ^GET[\ \t]*/(.*) GET\ /img.example.com/\1 if ssfc_img

 the backend webserver treats that accordingly.
 So far so good.. but given that this list will grow over time, it'll be a
 bit of a pain to manage this.

 Is there any way to make that happen by dynamic matches instead of a 1:1
 acl/reqrep pairing?
 Generating such a config isnt that much of a problem, but it lacks elegancy
 in my eyes ;-)

 TIA