I have a lot of paths (40k) to redirects.
So, that I would like to put them in the map file (that is, redirect-list file) to manage it.
But, those paths contain non-English paths too (which is required to be human readable and editable later on, it means that I can’t put url encode path there which will be matched fine).
Right now my current config looks like this:
frontend ssl_443
# bind *:443 ssl crt /etc/ssl/private/test.pem
bind *:443 ssl ssl crt-list /etc/haproxy/cert.crt-list
mode http
http-request set-header X-Forwarded-For %[src]
http-request add-header X-Forwarded-Proto https
option http-server-close
# acl thai path_beg -i /ทดสอบ <-- this matches fine.
# http-request set-path /my-new-path
http-request redirect location %[path,map(/etc/haproxy/redirect-list)]?%[query] code 301 if { path,map(/etc/haproxy/redirect-list) -m found } { query -m found }
http-request redirect location %[path,map(/etc/haproxy/redirect-list)] code 301 if { path,map(/etc/haproxy/redirect-list) -m found } ! { query -m found }
default_backend ssl_443
backend ssl_443
mode http
balance leastconn
server web1 10.0.0.1:80 check
~# cat /etc/haproxy/redirect-list
/google https://www.google.com
/555 /hahaha
/ทดสอบ /my-new-path
/ภาษาไทย /new-page
/my-old-path /my-new-path
When accessing
/ทดสอบ
, it does not match
But, accessing
/my-old-path
, it’s matched and redirected to /my-new-path
So, I wonder, is there any way to make the following if block:
if { path,map(/etc/haproxy/redirect-list) -m found } ! { query -m found }
matched with non-English path ?