Mass redirect using Haproxy map file

After some migration between applications versions you need to keep backward compatibility. Here example of easy way how to redirect lot of links to new location for Haproxy.  (example for Nginx)

Haproxy config example
map_hash_bucket_size 256;
 frontend http
  bind *:80
  bind *:443 ssl crt /etc/haproxy/all-domain-com.pem
  http-request redirect location %[capture.req.uri,map(/etc/haproxy/] code 301 if { capture.req.uri,map(/etc/haproxy/ -m found and hdr(host) -i }
  redirect scheme https code 301 if !{ ssl_fc }

Redirect MAP
map_hash_bucket_size 256;
# cat /etc/haproxy/ | head -5


Popular posts from this blog

Redis with failover replication

FreeRadius and Google Workspace LDAP