I have 1 haproxy server hosting for website.com and 1 nginx server hosting for static.website.com . I want when haproxy receive http request for http://website.com/static/image.jpg it will rewrite:
Host = website.com ==> Host=static.website.com
URI = /static/image.jpg ==> URI=/image.jpg
Then haproxy forward http request to nginx server, here
backend bk_nginx
mode http
# http-request replace-header if Host=website.com and URI=/static/image.jpg ==> rewrite them to Host=static.website.com and URI=/image.jpg
server node1 nginx-server:83 # forward http request to nginx server port 83 with Host=static.website.com and URI=/image.jpg
Thank you very much for your help.