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?
Thanks Jürgen Am 25.10.2016 um 15:47 schrieb Andrew Smalley: > 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/(.*) \1\ /\2 > > Regards > > Andrew Smalley > > Loadbalancer.org Ltd. > > > > On 25 October 2016 at 10:35, Jürgen Haas > <[email protected] > <mailto:[email protected]>> wrote: > > 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 <http://www.arocom.de> > acl r_path path_beg /de/ > reqirep "^([^\ :]*)\ /de/(.+)" "\1\ /\2" if r_host r_path > redirect prefix / code 301 if r_host r_path > http-response add-header X-Via aweb2 > server server_aweb2 1.2.3.4:80 <http://1.2.3.4:80> maxconn 100 > > Thanks > Jürgen > > > Am 24.10.2016 um 11:23 schrieb Andrew Smalley: > > 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 > > <[email protected] > <mailto:[email protected]> > > <mailto:[email protected] > > <mailto:jurgenhaas-m5i1dm4aril35hdljg3a3a-xmd5yjdbdmrexy1tmh2...@public.gmane.org>>> > wrote: > > > > 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 > <http://www.example.com/de/page-one> > > <http://www.example.com/de/page-one > <http://www.example.com/de/page-one>> => > > http://www.example.com/page-one > <http://www.example.com/page-one> <http://www.example.com/page-one > <http://www.example.com/page-one>> > > http://www.example.com/de/page-two > <http://www.example.com/de/page-two> > > <http://www.example.com/de/page-two > <http://www.example.com/de/page-two>> => > > http://www.example.com/page-two > <http://www.example.com/page-two> <http://www.example.com/page-two > <http://www.example.com/page-two>> > > > > In other words, we just want to remove the "/de" subsctring from the > > URL. Is that possible? > > > > > > Thanks > > Jürgen > > > > > > > > Am 24.10.2016 um 11:00 schrieb Andrew Smalley: > > > 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 > <https://www.haproxy.com/doc/aloha/7..0/haproxy/http_redirection.html> > > <https://www.haproxy.com/doc/aloha/7.0/haproxy/http_redirection.html > <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 > www.domain.com <http://www.domain.com> <http://www.domain.com> > > > <http://www.domain.com> redirect code 301 location > > > http://www.domain.com/ if is_domain is_de| > > > > > > > > > > > > Regards > > > > > > Andrew Smalley > > > > > > Loadbalancer.org Ltd. > > > > > > > > > > > > On 24 October 2016 at 09:53, Jürgen Haas > > > <[email protected] > > <mailto:jurgenhaas-m5i1dm4aril35hdljg3a3a-xmd5yjdbdmrexy1tmh2...@public.gmane.org> > > <mailto:[email protected] > > <mailto:jurgenhaas-m5i1dm4aril35hdljg3a3a-xmd5yjdbdmrexy1tmh2...@public.gmane.org>> > > > <mailto:[email protected] > > <mailto:jurgenhaas-m5i1dm4aril35hdljg3a3a-xmd5yjdbdmrexy1tmh2...@public.gmane.org> > > > > <mailto:jurgenhaas-m5i1dm4aril35hdljg3a3a-xmd5yjdbdmrexy1tmh2...@public.gmane.org > > <mailto:jurgenhaas-m5i1dm4aril35hdljg3a3a-xmd5yjdbdmrexy1tmh2ibg-xmd5yjdbdmrexy1tmh2...@public.gmane.org>>>> > > wrote: > > > > > > Hi all, > > > > > > one of my clients is looking for a wildcard redirect to > get redirects > > > from www.example.com/de/* <http://www.example.com/de/*> > <http://www.example.com/de/*> > > <http://www.example.com/de/*> to > > > www.example.com/* <http://www.example.com/*> > <http://www.example.com/*> > > <http://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 > > > > > > > > > > > > > > >

