Hi.

Am 12-11-2015 21:16, schrieb Guillaume Bourque:
Hi all,

I’m not far but it does not work so any recommendation would be very
helpfull

I just need some very simple redirect but after looking into aloa doc
the happy doc, I can’t find examples that could help me do this, okay
I must admit I did not sleep for the last 30 hours so that could explain
why I can understand what I read ;-)

This seem the way to do it, but it do not work for me I’m running
haproxy 1.5.4

http-request redirect location /store code 301 if { capture.req.uri
lang\= -m found }

here is what I need to do, I can do path rewrite fine, but the ? is
bugging us.

I need to redirect 301 client from this

http://domain.com/?lang= to http://domain.com/

http://domain.com/?lang=fr to http://domain.com/

http://domain.com/?lang=en to http://domain.com/en

http://domain.com/pages/magasin.php?lang=fr to http://domain.com/

It  can be on 3 differents lines I dont want to achieve light speed
performance I just need to have this working ASAP

So I try with this

http-request redirect location /store code 301 if { capture.req.uri
lang= -m found }

Or with an acl

acl fr_top            urlp_reg(lang\=$,?)     -m found
http-request redirect location http://www.braultetmartineau.com/ code
301 if fr_top

Do I need to escape anything in there

Any advice would be very appreciated

How about to use a example from this.

http://git.haproxy.org/?p=haproxy-1.5.git;a=blob;f=examples/acl-content-sw.cfg;h=1872789ac2d1198f4321e77c0dad4f382cc8f206;hb=HEAD

####
acl forbidden_uris url_reg -i (\.php\?temppath=|\.php\?setmodules=|[=:]http://)
block if forbidden_uris
####

I would try this, untested.

acl redir_en          url_reg -i .*lang=en
acl redir_empty_or_fr url_reg -i .*lang=($|fr)

redirect location http://domain.com/    code 301 if redir_empty_or_fr
redirect location http://domain.com/en/ code 301 if redir_en

Cheers
Aleks

Thanks

---
Guillaume Bourque, B.Sc.,

Le 2015-11-12 à 05:04, Guillaume Bourque
<guillaume.bour...@logisoftech.com> a écrit :

Hello Igor,

thanks a lot still not working

would I need to escape the =

http-request redirect location /store code 301 if { capture.req.uri
lang\= -m found }

Bye

---
Guillaume Bourque, B.Sc.,

Le 2015-11-12 à 03:59, Igor Cicimov <ig...@encompasscorporation.com>
a écrit :

On Thu, Nov 12, 2015 at 6:44 PM, Guillaume Bourque
<guillaume.bour...@logisoftech.com> wrote:

Hi,

thanks for the suggestion but it did not work for me.   I tried

acl fr_top                  url_reg                /?lang=
acl fr_top                  url_reg                /?lang=$
# off acl fr_top                            urlp_reg(lang\=$,?)
-m found
# off acl fr_top                            urlp_reg(lang\=$,?)
-m found

but with no luck

thanks

---
Guillaume Bourque, B.Sc.,

Le 2015-11-12 à 02:18, Igor Cicimov <ig...@encompasscorporation.com>
a écrit :

On 12/11/2015 5:30 PM, "Guillaume Bourque"
<guillaume.bour...@logisoftech.com> wrote:

Hello Bryan

I’m running haproxy 1.5.4 and I can’t find any example on how to
user req.uri if you could give a examples on how to match a specific
query to redirect to another

From http://domain/pages/store.php?lang=fr   to http://domain/store/

That would be great !

TIA



---
Guillaume Bourque, B.Sc.,

Le 2015-11-12 à 00:42, Bryan Talbot <bryan.tal...@ijji.com> a
écrit :

On Wed, Nov 11, 2015 at 8:43 PM, Guillaume Bourque
<guillaume.bour...@logisoftech.com> wrote:

Hi all,

I can’t create an acl that will match this

http://domain/?lang=

I tried

acl fr_top                  path_reg                ^/.lang\=$
acl fr_top                  path_reg
^/\?lang\=$

acl fr_top                        path_beg
/?lang\=$




You can't match the query string with the 'path' matcher. Try
'req.uri' or 'query' if you're using 1.6.



Try this:

acl fr_top  url_reg   /pages/store.php?lang=fr

Ok, my last try :-)

http-request redirect location /store code 301 if { capture.req.uri
lang= -m found }

Reply via email to