Hi Steven,

On Fri, Oct 18, 2013 at 01:40:13PM +0200, Steven Le Roux wrote:
> frontend app
>   bind *:80
>   acl p-static      url_reg  ^/context$
>   acl p-dyn      url_reg  ^/context/.*$
>   reqrep ^GET\ /context/(.*)     GET\ \1 if p-dyn
>   redirect code 301 location https://host.domain.tld/context if p-static
>   use_backend app if p-dyn
> 
> backend app
>   redirect code 302 prefix https://host.domain.tldt/context/?search=
> 
> 
> it's not working for me...

It's normal. The problem is not the ordering between your reqrep and
the redirect, as the redirect is performed *after* reqrep. The problem
is that the condition to perform the redirect is not matched anymore
after the reqrep was performed.

Please use a specific backend for both the transformation and the
redirect, in order not to have to rely on a condition that changes
in the middle of the operations :

 frontend app
   bind *:80
   acl p-static      url_reg  ^/context$
   acl p-dyn      url_reg  ^/context/.*$
   redirect code 301 location https://host.domain.tld/context if p-static
   use_backend app if p-dyn
 
 backend app
   reqrep ^GET\ /context/(.*)     GET\ \1
   redirect code 302 prefix https://host.domain.tldt/context/?search=

With this, it will work.

Regards,
Willy


Reply via email to