Am 27.10.2016 um 13:30 schrieb Jürgen Haas:
>> However Michael's suggestion of "http-request redirect code 301
>> location %[capture.req.uri,regsub(^/de,)] if { path_beg /de }" looks
>> even better.
>
> That looks great indeed. I'll give that a try and will report back.
It is working! Thank you
> However Michael's suggestion of "http-request redirect code 301
> location %[capture.req.uri,regsub(^/de,)] if { path_beg /de }" looks
> even better.
That looks great indeed. I'll give that a try and will report back.
Jurgen
following the rules I shared, maybe a different curl command or option
shows you better. this is using the same rule I previously provided
curl --head shows the information you have not been seeing.
[root@home htdocs]# curl --head http://192.168.0.99/
HTTP/1.1 200 OK
Date: Thu, 27 Oct
On Oct 27, 2016 6:41 AM, "Jürgen Haas" wrote:
>
> Thanks Andrew,
>
> I still believe that your example is not redirecting, it is forwarding
> to the Apache server which responds with a 200 and the same content as
> before.
>
> But what we're loking for is a redirect
I guess I have an explanation why the following set of rules does NOT
execute the redirect although it executes the reqirep which has the same
condition:
backend backend_test
http-response add-header X-Via TEST
acl do_redirect path_beg /de/
reqirep "^([^\ :]*)\ /de/(.+)" "\1\ /\2" if
Hello Jürgen
I have what is below which as I say seems to work and redirects to
/something when /de/something is provided and at the bottom I have a couple
of tests.
I've also put the response back in the list as I must have clicked reply
not reply to all.
frontend http
bind 192.168.0.99:80
Hi Andrew,
You mean just the reqrep line on its own does the redirect? Because if
not I would then require the redirect line in addition which then would
cause that loop.
Or is your approach just forwarding the corrected URi to the backend
such that it deals with the that and responds as if the
Hello Jürgen
Thank you for your reply saying its the same line you already have
I did this on a single VIP assuming you just wanted to rewrite /de to / and
have everything below /de/page-x become /page-x
If this is the case it works well and does not produce a redirect loop.
Try it out and see
Thanks Andrew,
That's the same regex that I have in my backend definition. But I also
need the ACLs to make sure that the redirect only happens on a specific
host and with a specific beginning of a path. Otherwise that would be
redirected every time and end up in an infinite loop, doesn't it?
Hello Jürgen
Sorry for the delay in replying to you.
after a little playing I have come up with this single line without an ACL
which seems to do what you want.
It will redirect http://domain.com/de/this/that/other/dir
To
http://domain.com/this/that/other/dir
reqrep ^([^\ :]*)\ /de/(.*)
Hi Andrew,
just not having luck with this. Here is my rule which is certainly used
when e.g. calling https://www.arocom.de/de/team but it doesn't redirect
to https://www.arocom.de/team
Any idea what's wrong?
backend backend_aweb2_https
acl r_host hdr(host) -i -n www.arocom.de
acl r_path
Hello Jürgen
In that case I think you will want something like
acl de_url path_beg /de
reqrep ^([^\ :]*)\ /de/\d+/(.+)/? \1\ /\2
redirect prefix / code 301 if de_url
Regards
Andrew Smalley
Loadbalancer.org Ltd.
On 24 October 2016 at 10:19, Jürgen Haas
Hi Andrew,
Thanks for your quick reply and yes, I'm using the manual almost daily.
But my question is not covered, I guess.
Also your example is not working as it is always redirecting to the
front page, but we would require wildcards.
Examples:
http://www.example.com/de/page-one =>
Hello Jürgen
Below is a link to the haproxy manual which will tell you exactly what you
wish to know.
https://www.haproxy.com/doc/aloha/7.0/haproxy/http_redirection.html
and something like this will be what you are looking to do
acl is_de path_beg -i /de
acl is_domain hdr(host) -i
Hi all,
one of my clients is looking for a wildcard redirect to get redirects
from www.example.com/de/* to www.example.com/*
I know how to do just the opposite, but for this one I couldn't find a
solution in the documentation.
Any chance that can be done?
Thanks
Jürgen
15 matches
Mail list logo