Hello,
I try to upgrade from HAproxy 1.8 to 2.6 and have to replace a lot of values, as many of them are not valid anymore, and I need a bit help:
- Example 1:
reqirep ^([^:\ ]+\ +)/(/.+)/(/.+)/(/.+)/(/.+)$ \1\2\3\4\5 if { path_beg // }
This is required, to remove double //
on a URL, which is from a broken upstream app, which is not under our control.
I’ve tried to use:
http-request replace-path ^([^:\ ]+\ +)/(/.+)/(/.+)/(/.+)/(/.+)$ \1\2\3\4\5 if { path_beg // }
but, I assume, that is wrong and would not work.
- Example 2:
reqirep ^(GET|POST|HEAD)\ /iframes/(.*) \1\ /\2 if iframe
reqirep ^(GET|POST|HEAD)\ /3dss/(.*) \1\ /\2 if 3dsecure
reqirep ^(GET|POST|HEAD)\ /wix/(.*) \1\ /\2 if wix
rspirep ^Location:\ (http|https)://fra-test-iframes.example.local\/(.*) Location:\ \1://%[hdr(host)]/iframes/\2 if response-is-redirect
rspirep ^Location:\ /(.*) Location:\ /3dss/\1 if 3dsecure_redirect
rspirep ^Location:\ /(.*) Location:\ /wix/\1 if wix_redirect
this block I’ve tried to replace with:
http-request replace-header ^(GET|POST|HEAD)\ /iframes/(.*) \1\ /\2 if iframe
http-request replace-header ^(GET|POST|HEAD)\ /3dss/(.*) \1\ /\2 if 3dsecure
http-request replace-header ^(GET|POST|HEAD)\ /wix/(.*) \1\ /\2 if wix
http-request replace-header ^Location:\ (http|https)://fra-test-iframes.example.local\/(.*) Location:\ \1://%[hdr(host)]/iframes/\2 if response-is-redirect
http-request replace-header ^Location:\ /(.*) Location:\ /3dss/\1 if 3dsecure_redirect
http-request replace-header ^Location:\ /(.*) Location:\ /wix/\1 if wix_redirect
but, HAproxy is not happy about it:
config : parsing [/opt/consul-template/data/haproxy.cfg:340] : error detected in backend 'appint' while parsing 'http-request replace-header' rule : regex '\1 /\2' is invalid (error=reference to non-existent subpattern, erroffset=1).
It would be nice, if someone can help me, to get it converted to 2.6
cu denny
1 post - 1 participant