Re: Replace deprecated reqrep

2019-07-10 Thread Tim Düsterhus
Willy,

Am 09.07.19 um 08:11 schrieb Willy Tarreau:
> Maybe we should add such examples in the reqrep doc ? Or maybe we
> should wait for 1 or 2 other ones to complement this one ?

Technically it's already (sufficiently) documented in replace-uri
(though not in terms of reqrep):
http://cbonte.github.io/haproxy-dconv/2.1/configuration.html#4.2-http-request%20replace-uri

Best regards
Tim Düsterhus



Re: Replace deprecated reqrep

2019-07-09 Thread Willy Tarreau
On Mon, Jul 08, 2019 at 02:36:13PM +0200, Tim Düsterhus wrote:
> Artur.
> 
> Am 08.07.19 um 14:25 schrieb Artur:
> > Hello,
> > 
> > Could you please suggest how to rewrite following rules written with
> > 'regrep' with 'http-request replace-uri' :
> > 
> > frontend www
> >  reqrep ^([^\ ]*)\ /p3/js/(.*) \1\ /p3/js-min/\2
> > 
> > The idea is to rewrite something similar to "GET /p3/js/file.js
> > HTTP/1.1" with  "GET /p3/js-min/file.js HTTP/1.1".
> > 
> 
> You basically can copy over the "second half" of your rule and adjust
> the numbers referencing the capturing groups:
> 
> http-request replace-uri /p3/js/(.*) /p3/js-min/\1
> 
> Consider either adding a `^` at the start to only match URLs starting
> with /p3/ or add an `if` that ensures only URLs starting with /p3/ are
> modified.

Maybe we should add such examples in the reqrep doc ? Or maybe we
should wait for 1 or 2 other ones to complement this one ?

Willy



Re: Replace deprecated reqrep

2019-07-08 Thread Tim Düsterhus
Artur.

Am 08.07.19 um 14:25 schrieb Artur:
> Hello,
> 
> Could you please suggest how to rewrite following rules written with
> 'regrep' with 'http-request replace-uri' :
> 
> frontend www
>  reqrep ^([^\ ]*)\ /p3/js/(.*) \1\ /p3/js-min/\2
> 
> The idea is to rewrite something similar to "GET /p3/js/file.js
> HTTP/1.1" with  "GET /p3/js-min/file.js HTTP/1.1".
> 

You basically can copy over the "second half" of your rule and adjust
the numbers referencing the capturing groups:

http-request replace-uri /p3/js/(.*) /p3/js-min/\1

Consider either adding a `^` at the start to only match URLs starting
with /p3/ or add an `if` that ensures only URLs starting with /p3/ are
modified.

Best regards
Tim Düsterhus



Replace deprecated reqrep

2019-07-08 Thread Artur
Hello,

Could you please suggest how to rewrite following rules written with
'regrep' with 'http-request replace-uri' :

frontend www
 reqrep ^([^\ ]*)\ /p3/js/(.*) \1\ /p3/js-min/\2

The idea is to rewrite something similar to "GET /p3/js/file.js
HTTP/1.1" with  "GET /p3/js-min/file.js HTTP/1.1".

-- 
Best regards,
Artur