RE: Rewriting/redirecting part of URL

2017-06-29 Thread Mark Holmes
Perfect, does exactly what I need. Thanks again Philipp.

-Original Message-
From: Philipp Buehler [mailto:e1c1bac6253dc54a1e89ddc046585...@posteo.net] 
Sent: 29 June 2017 12:50
To: Mark Holmes
Cc: 'haproxy@formilux.org'
Subject: RE: Rewriting/redirecting part of URL

Am 29.06.2017 13:32 schrieb Mark Holmes:
> This worked perfectly - thanks again Philipp - but now the goalposts 
> have moved slightly...
> 
> 
> So what I need to do is
> 
> If a request comes in for www.old.com/audi/thesite/pages
> 
> I'd like to redirect to
> 
> www.new.com/audi/thesite/pages
> 
>  maintaining everything after the first /
> 
> 
> But if a request comes in for www.old.com/somethingelse
> 
> I don't want to redirect, it should just end up on 
> www.old.com/somethingelse
> 
> So basically, anything /audi gets redirected maintaining everything 
> after /
> 
> Everything else doesn't get redirected.
> 
> I can feel some kind or Regex situation here...
> 
> Grateful for any suggestions.

just more acl - now on the path.
acl audimeh path_beg /audi
acl oldthings hdr(host) -i old.com
http-request redirect prefix https://new.com if oldthings audimeh

--
pb

This e-mail message is being sent solely for use by the intended recipient(s) 
and may contain confidential information.  Any unauthorized review, use, 
disclosure or distribution is prohibited.  If you are not the intended 
recipient, please contact the sender by phone or reply by e-mail, delete the 
original message and destroy all copies. Thank you.



RE: Rewriting/redirecting part of URL

2017-06-29 Thread Philipp Buehler

Am 29.06.2017 13:32 schrieb Mark Holmes:

This worked perfectly - thanks again Philipp - but now the goalposts
have moved slightly...


So what I need to do is

If a request comes in for www.old.com/audi/thesite/pages

I'd like to redirect to

www.new.com/audi/thesite/pages

 maintaining everything after the first /


But if a request comes in for www.old.com/somethingelse

I don't want to redirect, it should just end up on 
www.old.com/somethingelse


So basically, anything /audi gets redirected maintaining everything 
after /


Everything else doesn't get redirected.

I can feel some kind or Regex situation here...

Grateful for any suggestions.


just more acl - now on the path.
acl audimeh path_beg /audi
acl oldthings hdr(host) -i old.com
http-request redirect prefix https://new.com if oldthings audimeh

--
pb



RE: Rewriting/redirecting part of URL

2017-06-29 Thread Mark Holmes
This worked perfectly - thanks again Philipp - but now the goalposts have moved 
slightly...


So what I need to do is

If a request comes in for www.old.com/audi/thesite/pages

I'd like to redirect to

www.new.com/audi/thesite/pages

 maintaining everything after the first /


But if a request comes in for www.old.com/somethingelse

I don't want to redirect, it should just end up on www.old.com/somethingelse

So basically, anything /audi gets redirected maintaining everything after /

Everything else doesn't get redirected.

I can feel some kind or Regex situation here...

Grateful for any suggestions.

Thanks!

Mark






-Original Message-
From: Mark Holmes [mailto:mark.hol...@eu.biworldwide.com] 
Sent: 28 June 2017 19:01
To: 'Philipp Buehler'
Cc: 'haproxy@formilux.org'
Subject: RE: Rewriting/redirecting part of URL

Great, I'll give that a go. Thanks Philipp! 

PS Don't feel sorry for me, I don't work for VWG group directly :)

-Original Message-
From: Philipp Buehler [mailto:e1c1bac6253dc54a1e89ddc046585...@posteo.net]
Sent: 28 June 2017 18:37
To: Mark Holmes
Cc: 'haproxy@formilux.org'
Subject: Re: Rewriting/redirecting part of URL

Am 28.06.2017 19:20 schrieb Mark Holmes:
> Note that /audi/page/whatever will change all the time - essentially, 
> I want to preserve whatever comes after the first /, just rewriting 
> the domain part

I feel bad for "Audi" (shouts from an ex-Daimler one.. :D ) now.

With 1.6 you can just do that with 'http-request' and 'prefix':
acl oldthings hdr(host) -i old.com
http-request redirect prefix https://new.com if oldthings

HTH,
--
pb

This e-mail message is being sent solely for use by the intended recipient(s) 
and may contain confidential information.  Any unauthorized review, use, 
disclosure or distribution is prohibited.  If you are not the intended 
recipient, please contact the sender by phone or reply by e-mail, delete the 
original message and destroy all copies. Thank you.

This e-mail message is being sent solely for use by the intended recipient(s) 
and may contain confidential information.  Any unauthorized review, use, 
disclosure or distribution is prohibited.  If you are not the intended 
recipient, please contact the sender by phone or reply by e-mail, delete the 
original message and destroy all copies. Thank you.



RE: Rewriting/redirecting part of URL

2017-06-28 Thread Mark Holmes
Great, I'll give that a go. Thanks Philipp! 

PS Don't feel sorry for me, I don't work for VWG group directly :)

-Original Message-
From: Philipp Buehler [mailto:e1c1bac6253dc54a1e89ddc046585...@posteo.net] 
Sent: 28 June 2017 18:37
To: Mark Holmes
Cc: 'haproxy@formilux.org'
Subject: Re: Rewriting/redirecting part of URL

Am 28.06.2017 19:20 schrieb Mark Holmes:
> Note that /audi/page/whatever will change all the time - essentially, 
> I want to preserve whatever comes after the first /, just rewriting 
> the domain part

I feel bad for "Audi" (shouts from an ex-Daimler one.. :D ) now.

With 1.6 you can just do that with 'http-request' and 'prefix':
acl oldthings hdr(host) -i old.com
http-request redirect prefix https://new.com if oldthings

HTH,
--
pb

This e-mail message is being sent solely for use by the intended recipient(s) 
and may contain confidential information.  Any unauthorized review, use, 
disclosure or distribution is prohibited.  If you are not the intended 
recipient, please contact the sender by phone or reply by e-mail, delete the 
original message and destroy all copies. Thank you.



Re: Rewriting/redirecting part of URL

2017-06-28 Thread Philipp Buehler

Am 28.06.2017 19:20 schrieb Mark Holmes:

Note that /audi/page/whatever will change all the time - essentially,
I want to preserve whatever comes after the first /, just rewriting
the domain part


I feel bad for "Audi" (shouts from an ex-Daimler one.. :D ) now.

With 1.6 you can just do that with 'http-request' and 'prefix':
acl oldthings hdr(host) -i old.com
http-request redirect prefix https://new.com if oldthings

HTH,
--
pb



Rewriting/redirecting part of URL

2017-06-28 Thread Mark Holmes
Hi all,

I am trying to achieve the following in haproxy 1.6.6

We have a URL

www.old.com/audi/page/whatever

I'd like to redirect, maintaining everything after the first / ie 
/audi/page/whatever

For example

www.old.com/audi/page/whatever

redirects to

www.new.com/audi/page/whatever

Note that /audi/page/whatever will change all the time - essentially, I want to 
preserve whatever comes after the first /, just rewriting the domain part

I've tried a few things, the below seems to work if I hit the URL using HTTP 
but not if I use HTTPS (I need HTTPS)


frontend www.new.com
mode http
bind 145.90.33.11:80
bind 145.90.33.11:443 ssl crt /etc/haproxy/keys/www.new.com.pem no-sslv3 
ciphers 
ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-G$



#acl h_static hdr(Host) -m beg www.new.com

#reqirep ^Host:\ www.new.com  Host:\ www.old.com if h_static


redirect scheme https if !{ ssl_fc }
option forwardfor


default_backend www.old.com

backend www.old.com
mode http
balance roundrobin
cookie SERVERID insert indirect nocache secure

server Node1 pp-websv08:1061 check cookie Node1
server Node2 pp-websv09:1061 check cookie Node2
server Sorry_Server 192.168.33.200:80 check backup



Grateful for any suggestions and thanks for reading!


Mark


This e-mail message is being sent solely for use by the intended recipient(s) 
and may contain confidential information.  Any unauthorized review, use, 
disclosure or distribution is prohibited.  If you are not the intended 
recipient, please contact the sender by phone or reply by e-mail, delete the 
original message and destroy all copies. Thank you.