Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace regrep for HAproxy 2.x

Tags:

haproxy

I need to administrate a server with a previously configured HAproxy v1.8. After updating to v2.4 I noticed the error about regrep not used anymore:

[ALERT]    (1574) : parsing [/etc/haproxy/haproxy.cfg:310] : The 'reqrep' directive is not supported anymore since HAProxy 2.1. Use 'http-request replace-path', 'http-request replace-uri' or 'http-request replace-header' instead.

I was following some documentation but cannot really be sure I'm using the correct way to replace regrep. The configuration line in haproxy.cfg, in backend section:

  reqrep ^([^\ :]*)\ /amc[/]?(.*)  \1\ //\2

What is the correct way to update it?

like image 335
Ecofintech Avatar asked Oct 24 '25 14:10

Ecofintech


1 Answers

It looks to me that you want to replace the path.
You can try the following, untested.

http-request replace-path /amc[/]?(.*) /\1

More examples can be found in the doc http-request replace-path

like image 108
Aleksandar Avatar answered Oct 26 '25 16:10

Aleksandar