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
TL;DR
I'm trying to add a simple path rewrite rule to drop a specific first part of a path when received from the front-end. I'm not sure if I'm overlooking something in the api docs or whether I'm dealing with some bugs here. I really would appreciate any feedback.
Method 1 - set-uri
Currently using haproxy v2 and dataplane api and running into and issue trying to rewrite the path.
Goal is to add a rule to a backend in haproxy:
http-request set-uri %[url,regsub(^/metrics/,/,)] if { path_beg /metrics }
I've been using the url as per documentation with the needed query params:
I've also tried with the "uri-match" and "uri-fmt" as well as "path_match" and "path_fmt", however the result is always the same. It ends up with an empty space for the expression used (mind, two spaces instead of one!):
http-request set-uri if { path_beg /metrics }
The issue:
I can't seem to get the required expression into Haproxy using the dataplane api for HTTPRequestRule
Method 2 - path-replace
The other attempted approach is using the path-replace approach.
I've been using the url as per documentation with the needed query params:
http-request replace-path /metrics/(.*) /\\1 if { url_beg /metrics/ }
The issue: escape carries into the haproxy rules
It seems that the escape backslash used to satisfy JSON standards, carries on into the Haproxy config rule instead of being dropped. I'd expect this to break the look-back reference in haproxy.cfg
Expected output into haproxy.cfg:
http-request replace-path /metrics/(.*) /\1 if { url_beg /metrics/ }
The text was updated successfully, but these errors were encountered:
TL;DR
I'm trying to add a simple path rewrite rule to drop a specific first part of a path when received from the front-end. I'm not sure if I'm overlooking something in the api docs or whether I'm dealing with some bugs here. I really would appreciate any feedback.
Method 1 - set-uri
Currently using haproxy v2 and dataplane api and running into and issue trying to rewrite the path.
Goal is to add a rule to a backend in haproxy:
I've been using the url as per documentation with the needed query params:
With the JSON payload on POST request:
I've also tried with the
"uri-match"
and"uri-fmt"
as well as"path_match"
and"path_fmt"
, however the result is always the same. It ends up with an empty space for the expression used (mind, two spaces instead of one!):The issue:
I can't seem to get the required expression into Haproxy using the dataplane api for HTTPRequestRule
Method 2 - path-replace
The other attempted approach is using the
path-replace
approach.I've been using the url as per documentation with the needed query params:
With the JSON payload on POST request:
The resulting rule in
haproxy.cfg
:The issue: escape carries into the haproxy rules
It seems that the escape backslash used to satisfy JSON standards, carries on into the Haproxy config rule instead of being dropped. I'd expect this to break the look-back reference in
haproxy.cfg
Expected output into
haproxy.cfg
:The text was updated successfully, but these errors were encountered: