Thanks Nanad,

That works perfectly, thank you

On 11 March 2016 at 22:37, Nenad Merdanovic <ni...@nimzo.info> wrote:

> Hello Neil,
>
> You seem to have missed my answer, so I am gonna top post this time :)
>
> http-request redirect location
> %[hdr(host),map(/etc/haproxy/redirect_host.map)] code 301 if {
> hdr(host),map(/etc/haproxy/redirect_host.map) -m found }
>
> Regards,
> Nenad
>
> On 03/11/2016 11:32 PM, Neil - HAProxy List wrote:
> > Hello
> >
> > I've left a little time and no one has said anything more so time for me
> > to act and submit a patch.
> >
> > I want to make functions that can be used in acls and take a map and
> > provide has_key and, for completeness, has_value
> >
> > Are those names uncontroversial/ suitable and, i really hope, is this
> > unnecessary as it already exists.
> >
> > I'm more that a little surprised to find myself the first to want this
> >
> > Cheers
> >
> > Neil
> >
> > On 11 Mar 2016 22:16, "Neil" <n...@iamafreeman.com
> > <mailto:n...@iamafreeman.com>> wrote:
> >
> >     Hello
> >
> >     I've left a little time and no one has said anything more so time
> >     for me to act and submit a patch.
> >
> >     I want to make functions that can be used in acls and take a map and
> >     provide has_key and, for completeness, has_value
> >
> >     Are those names uncontroversia/ suitablel and, i really hope, is
> >     this unnecessary as it already exists.
> >
> >     I'm more that a little sutprised to find myself the first to want
> this
> >
> >     Cheers
> >
> >     Neil
> >
> >     On 3 Mar 2016 18:08, "Neil - HAProxy List"
> >     <maillist-hapr...@iamafreeman.com
> >     <mailto:maillist-hapr...@iamafreeman.com>> wrote:
> >
> >         Thanks Conrad,
> >
> >         That sort of thing looks better that what I had, and I'll give
> >         it a go.
> >
> >         I still think this is a bit long winded syntax for something
> >         that probably quite a common things to want to do?  A
> >         map_contains type boolean function still seems like a good to
> have?
> >
> >         Thanks
> >
> >         Neil
> >
> >         On 3 March 2016 at 13:05, Conrad Hoffmann <con...@soundcloud.com
> >         <mailto:con...@soundcloud.com>> wrote:
> >
> >             If you are using haproxy >=1.6, you might be able to do
> >             something like this:
> >
> >             acl no_redir %[req.redir] -m str NO_REDIR
> >             http-request set-var(req.redir) \
> >                 %[hdr(host),map(/etc/haproxy/redirect_host.map,NO_REDIR)]
> >             http-request redirect location %[req.redir] code 301 if
> >             !no_redir
> >
> >             This is completely made up and untested, but I hope you get
> >             the idea.
> >             Avoids a second map lookup altogether, but also map lookups
> >             are quite fast,
> >             so unless you map is huge you don't really need to worry
> >             about this. Also,
> >             double negation, but this is just to give you some idea
> >
> >             Cheers,
> >             Conrad
> >             --
> >             Conrad Hoffmann
> >             Traffic Engineer
> >
> >             SoundCloud Ltd. | Rheinsberger Str. 76/77, 10115 Berlin,
> Germany
> >
> >             Managing Director: Alexander Ljung | Incorporated in England
> >             & Wales
> >             with Company No. 6343600 | Local Branch Office | AG
> >             Charlottenburg |
> >             HRB 110657B
> >
> >
>

Reply via email to