RE: Seeking Guidance: 2.1.0 Config Error

2019-11-29 Thread Coscend@HAProxy
Hello Aleks and Tim,

Thank you for your insightful guidance on the usage of http-request and 
http-response in our context.  

We are updating the config files—several of them--along the lines you have 
suggested.  We will test it and will push it into production shortly.

Thank you.

Sincerely,

Hemant K. Sabat
www.Coscend.com <http://www.coscend.com/>  
--
Real-time, Interactive Tele-healthcare, Tele-education, Telepresence Services, 
on the fly…
--
CONFIDENTIALITY NOTICE: See 'Confidentiality Notice Regarding E-mail Messages 
from Coscend Communications Solutions' posted at: 
http://www.Coscend.com/Anchor/Common/Terms_and_Conditions.html




-Original Message-
From: Tim Düsterhus [mailto:t...@bastelstu.be] 
Sent: Thursday, November 28, 2019 3:14 AM
To: Aleksandar Lazic ; Coscend@HAProxy 

Cc: haproxy@formilux.org
Subject: Re: Seeking Guidance: 2.1.0 Config Error

Aleks,

Am 27.11.19 um 22:36 schrieb Aleksandar Lazic:
> This should be replace-uri 
> http://cbonte.github.io/haproxy-dconv/2.1/configuration.html#4.2-http-
> request%20replace-uri
> 
> I would try this.
> http-request replace-uri /CoscendP/*([^\ ]*)\ (.*)$ /\2\ \3
> 
> 
>> http-response replace-header ^(Location:)\ (https?://([^/]*))/(.*)$ 
>> Location:\ /CoscendP/\3
> 
> I would use this as the header name isn't a regex.
> 
> http-response replace-header Location (https?://([^/]*))/(.*)$ 
> Location:\ /CoscendP/\3
> 
> http://cbonte.github.io/haproxy-dconv/2.1/configuration.html#4.2-http-
> request%20replace-header
> 

FYI: You made the same mistake I made. You forgot to adjust the numbers of the 
capturing groups in the replacement after removing the first one from the regex.

Best regards
Tim Düsterhus


Re: Seeking Guidance: 2.1.0 Config Error

2019-11-27 Thread Tim Düsterhus
Aleks,

Am 27.11.19 um 22:36 schrieb Aleksandar Lazic:
> This should be replace-uri 
> http://cbonte.github.io/haproxy-dconv/2.1/configuration.html#4.2-http-request%20replace-uri
> 
> I would try this.
> http-request replace-uri /CoscendP/*([^\ ]*)\ (.*)$ /\2\ \3
> 
> 
>> http-response replace-header ^(Location:)\ (https?://([^/]*))/(.*)$ 
>> Location:\ /CoscendP/\3
> 
> I would use this as the header name isn't a regex.
> 
> http-response replace-header Location (https?://([^/]*))/(.*)$ Location:\ 
> /CoscendP/\3
> 
> http://cbonte.github.io/haproxy-dconv/2.1/configuration.html#4.2-http-request%20replace-header
> 

FYI: You made the same mistake I made. You forgot to adjust the numbers
of the capturing groups in the replacement after removing the first one
from the regex.

Best regards
Tim Düsterhus



Re: Seeking Guidance: 2.1.0 Config Error

2019-11-27 Thread Tim Düsterhus
Hemant,

Sorry, I forgot to adjust the capturing groups. There is an off-by-one
in my examples.

Am 27.11.19 um 22:39 schrieb Tim Düsterhus:
> http-request replace-uri ^/CoscendP/*([^\ ]*)\ (.*)$ \1\ /\2\ \3

This should read:

http-request replace-uri ^/CoscendP/*([^\ ]*)\ (.*)$ /\1\ \2

> http-response replacer-header Location ^(https?://([^/]*))/(.*)$
> /CoscendP/\3

This should read:

http-response replacer-header Location ^(https?://([^/]*))/(.*)$
/CoscendP/\2

Best regards
Tim Düsterhus



Re: Seeking Guidance: 2.1.0 Config Error

2019-11-27 Thread Tim Düsterhus
Hemant,

Am 27.11.19 um 21:37 schrieb Coscend@HAProxy:
> 2.0.9 config line that worked:
> 
> reqirep ^([^\ ]*)\ /CoscendP/*([^\ ]*)\ (.*)$   \1\ /\2\ \3
> 
> rspirep ^(Location:)\ (https?://([^/]*))/(.*)$Location:\
> /CoscendP/\3 
> 
> Corresponding 2.1.0 config line that gives errors:
> 
> http-request replace-header ^([^\ ]*)\ /CoscendP/*([^\ ]*)\ (.*)$
> \1\ /\2\ \3

Use http-request replace-uri, because you are not matching a header:
http://cbonte.github.io/haproxy-dconv/2.0/configuration.html#4.2-http-request%20replace-uri

http-request replace-uri ^/CoscendP/*([^\ ]*)\ (.*)$ \1\ /\2\ \3

> http-response replace-header ^(Location:)\ (https?://([^/]*))/(.*)$
> Location:\ /CoscendP/\3 
> 

Specify the header name as a separate parameter. You don't need to
specify it in the replacement:

http-response replacer-header Location ^(https?://([^/]*))/(.*)$
/CoscendP/\3

Best regards
Tim Düsterhus



Re: Seeking Guidance: 2.1.0 Config Error

2019-11-27 Thread Aleksandar Lazic


Hi.

Nov 27, 2019 9:38:35 PM Coscend@HAProxy :

>
> Dear HAProxy Community,
>
>
>
> We are upgrading from 2.0.9 to 2.1.0. Accordingly, we have to replace:
>
> · reqirep with http-request and
>
> · resprep with http-response.
>
>
>
> We are getting the following two errors.
>
> Error 1: 'http-request replace-header' expects exactly 3 arguments.
>
> Error 2: 'http-response replace-header' expects exactly 3 arguments.
>
>
>
> We would appreciate any insight into what we are missing in our config lines 
> below:
>
>
>
> 2.0.9 config line that worked:
>
> reqirep ^([^\ ]*)\ /CoscendP/*([^\ ]*)\ (.*)$ \1\ /\2\ \3
>
> rspirep ^(Location:)\ (https?://([^/]*))/(.*)$ Location:\ /CoscendP/\3
>
> Corresponding 2.1.0 config line that gives errors:
>
> http-request replace-header ^([^\ ]*)\ /CoscendP/*([^\ ]*)\ (.*)$ \1\ /\2\ \3

This should be replace-uri 
http://cbonte.github.io/haproxy-dconv/2.1/configuration.html#4.2-http-request%20replace-uri

I would try this.
http-request replace-uri /CoscendP/*([^\ ]*)\ (.*)$ /\2\ \3


> http-response replace-header ^(Location:)\ (https?://([^/]*))/(.*)$ 
> Location:\ /CoscendP/\3

I would use this as the header name isn't a regex.

http-response replace-header Location (https?://([^/]*))/(.*)$ Location:\ 
/CoscendP/\3

http://cbonte.github.io/haproxy-dconv/2.1/configuration.html#4.2-http-request%20replace-header

> Thank you.
>
> Sincerely,
>
> Hemant K. Sabat

Best regards
Aleks

> www.Coscend.com [http://www.coscend.com/]
>
> --
>
> Real-time, Interactive Tele-healthcare, Tele-education, Telepresence 
> Services, on the fly…
>
> --
>
> CONFIDENTIALITY NOTICE: See 'Confidentiality Notice Regarding E-mail Messages 
> from Coscend Communications Solutions' posted at: 
> http://www.Coscend.com/Anchor/Common/Terms_and_Conditions.html 
> [http://www.coscend.com/Anchor/Common/Terms_and_Conditions.html]