Please note that “rewrite” can mean a lot of things when it comes to HTTP. Please be more specific, and give a concrete example in terms of “this is the original browser request, this is how it should actually be reaching the backend server, and this is how the reply body should be changed (if applicable)”.
Do you need to just replace the Host
request header? If so use http-request set-header Host www.domain2.com
.
I would also point you to a previous discussion about this topic which discusses a few options: