You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the first expression in search is the host, also you don't give an explanation for spaces before first and second reg expression and also there is a space at replacing path.
You consider as sample the expression:
https://example.com/api/v1/api-name/
But this is wrong because the expression is something like:
GET /api/v1/api-name/
So, the first match corresponds to a method, not to a host
You can figure this out if you read the tutorial related to reqrep, where tells:
The statement reqrep applies a regex to each line of the request buffer in a case sensitive manner. As does reqirep, which is case insensitive
So, the request buffer looks like bellow:
GET /api/v1/api-name HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT) Host: www.tutorialspoint.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive
Now I believe make more sense why there is a space after the first reg expression
^([^\ :]*)\ /api/v1/api-name/(.*)
will match the expression
GET /api/v1/api-name HTTP/1.1
In conclusion, there are no 3 parts in regex, but only 2, as the haproxy tutorial explain:
reqrep <search> <replace> [<cond>]
Thank you for your effort, you point me to right direction, also that space bother me and I investigate more in order to understand better. So I'd like to share my effort in order to let you fix your explanation.
The text was updated successfully, but these errors were encountered:
You assume in the bellow expression:
reqrep ^([^\ :]*)\ /api/v1/api-name/(.*) \1\ /staging/path-name/\
the first expression in search is the host, also you don't give an explanation for spaces before first and second reg expression and also there is a space at replacing path.
You consider as sample the expression:
https://example.com/api/v1/api-name/
But this is wrong because the expression is something like:
GET /api/v1/api-name/
So, the first match corresponds to a method, not to a host
You can figure this out if you read the tutorial related to reqrep, where tells:
So, the request buffer looks like bellow:
GET /api/v1/api-name HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT) Host: www.tutorialspoint.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive
Now I believe make more sense why there is a space after the first reg expression
^([^\ :]*)\ /api/v1/api-name/(.*)
will match the expression
GET /api/v1/api-name HTTP/1.1
In conclusion, there are no 3 parts in regex, but only 2, as the haproxy tutorial explain:
reqrep <search> <replace> [<cond>]
Thank you for your effort, you point me to right direction, also that space bother me and I investigate more in order to understand better. So I'd like to share my effort in order to let you fix your explanation.
The text was updated successfully, but these errors were encountered: