On Fri, Jan 29, 2016 at 2:27 AM, Klavs Klavsen <k...@vsen.dk> wrote:

> I got this to work:
>
> use_backend %[path,lower,map_reg(/path/tofile)]
>
> and with a map file containing:
> ^\/sebseb/
> ^\/test2/
>
> and so on..
>
> Only issue is the performance hit.. its going to do regex match with path
> on each line in the map file.. :(
>

I've seen people reporting here map files with hundreds of lines claiming
no performance impact. In your case with your 2 liner file you shouldn't
see any performance impact whatsoever.


>
> I'd prefer to find a function to replace path.. which could substract the
> first part ^\/([^/])\/ - and then use \1 to match in map file..
>
> But perhaps the map_reg isn't that expensive?
>
>
> Klavs Klavsen wrote on 01/28/2016 03:39 PM:
>
>> Hi guys,
>>
>> I figured I could use map feature of 1.5, but I'm coming up short,
>> trying to change this:
>>
>>   use_backend %[req.hdr(host),lower,map(/path/tofile)]
>>
>>
>> To instead take a part of the uri.
>>
>> I can't find any list of functions (such as hdr, hdr_end etc.) in the
>> docs :(
>>
>> I figured I could use "something like" regrep instead of hdr(host)?
>>
>>
>> Klavs Klavsen wrote on 01/26/2016 02:53 PM:
>>
>>> Hi guys,
>>>
>>> we have a long list of backends (want to monitor each application on a
>>> tomcat behind us) - and would like to use part of the url ( first part
>>> between / / ) to identify the backend (in haproxy) to use.
>>>
>>> so if we get a request for /sebseb/api/whatever - we'd like to use
>>> backend named kki-sebseb.
>>>
>>> we figure this should not be dangerous since haproxy seems fairly well
>>> coded - so a request for something bogus, should just result in the
>>> backend being invalid - and returning a 504 (we hope) ?
>>>
>>> I can't seem to find any examples on the net.. and can't figure it out
>>> from the haproxy 1.5 docs..
>>>
>>> I was hoping any of you had some hints :)
>>>
>>>
>>
>>
>
> --
> Regards,
> Klavs Klavsen, GSEC - k...@vsen.dk - http://www.vsen.dk - Tlf. 61281200
>
> "Those who do not understand Unix are condemned to reinvent it, poorly."
>   --Henry Spencer
>
>
>


-- 
Igor Cicimov | DevOps


p. +61 (0) 433 078 728
e. ig...@encompasscorporation.com <http://encompasscorporation.com/>
w*.* encompasscorporation.com
a. Level 4, 65 York Street, Sydney 2000

Reply via email to