Haproxy remove cookie request

I’m wuold like use haproxy in front of my IIS application ASP.net, which is in intranet.
My public dns must be change from www.myapp.com to myapp.intra.net so I’m using http-request set header to rewrite host header:
backend coappesed01
mode http
option http-server-close
option forwardfor
acl hdr_myapp req.hdr(host) -i www.myapp.com
http-request set-header Host myapp.intra.net if hdr_myapp
server server01 myapp.intra.net:80 cookie server01 check inter 60 fastinter 20 fall 3 rise 2 weight 100

Thi configuration doesn’t work because haproxy insert “set-cookie” on the reposnse cookie and not in the request cookie, so my application doesn’t work.
How can I configure haproxy to rewrite hostheader and leave unchanged cookies?
Thank a lot

Why are you using HAProxy cookies? Do you have multiple backend servers and require some sort of “sticky-session”? (I ask because in the configuration file you have only one server.)

My guess is that your application cookies “break” because your ASP server sets them on what it believes to be the “right” host, namely the old one www.myapp.com, meanwhile you want the browser to actually send them for the new domain myapp.intra.net.

The simplest solution is to configure the ASP server not to configure any domain, and thus the browser would choose whatever the current domain is.

HI ciprian,
in my backend configuration I have only one server, and I don’t need balancing, but in my IIS I have several web sites and the only way I can correctly address requests is to specify the binding

Then remove the cookies settings from HAProxy, and make sure that the domain on which the cookie is set is the new one, or the one you have in the browser’s URL.

To summarize: HAProxy is not at fault for your issue, it is the fact that the browser and your backend services have different “oppinions” about what the hostname of the site / application is.