Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HAProxy rewrite of host and path

Tags:

haproxy

this should be a pretty simple rewrite rule, but I can't get it working. I want to rewrite Request as follows:

http://acme.org/FOO/BAR

to

http://FOO.acme.org/BAR

FOO is some simple string in this case and BAR should match the rest of the URL. It seems as reqrep does not allow the rewrite of the host :(

like image 679
mana Avatar asked Dec 20 '22 17:12

mana


1 Answers

But nowadays it's better to replace host with

http-request replace-header Host .* FOO.acme.org

since reqirep is deprecated since haproxy 1.6.

like image 114
Andrey Regentov Avatar answered Mar 03 '23 21:03

Andrey Regentov