Thanks Thomas,
It worked. There is really a lot of options so I missed this one.
Best regards
Peter
-----Original Message-----
From: Thomas Heil <[email protected]>
Date: Monday, July 1, 2013 10:24 AM
To: Hudec Peter <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: Re: haproxy is not rewriting the Host header in subsequent request
>Hi,
>
>On 01.07.2013 09:31, Hudec Peter wrote:
>> Hi all,
>>
>> I'm trying to replace the nginx setup with the haprixy which seems to be
>> more suitable for our purposes.
>>
>> In our setup there are several development servers hidden behind the HA
>> PROXY. The development dserver are the copy of the template. On the
>>NGINX
>> I'm doit Host header rewrite
>>
>> <client> ---> www04.devel.domain.com ---> nginx ---->
>>www.devel.domain.com
>> -----> www04.dev.(server)
>>
>> Each of the devel server is able to handle domain www.devel.domain.com,
>> the nginx is rewtiting the
>>
>> Nginx configuration looks like /only relevant parts .../
>> server {
>> server_name www04.devel.domain.com;
>> proxy_redirect off;
>> proxy_set_header Host www.devel.domain.com;
>> proxy_set_header X-Real-IP $remote_addr;
>> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>> proxy_set_header X-Forwarded-Proto $scheme;
>>
>>
>> location / {
>> proxy_pass http://backend_domain_www_servers_devel04;
>> proxy_redirect http://www.devel.domain.com/ https://$host/;
>> }
>> }
>>
>> For HAPROXY I tried this
>>
>> backend devel-web04
>> reqrep ^Host: Host:\ www.devel.domain.com
>> rspirep ^(.*)www.devel.domain.com(.*) \1www04.devel.domain.com\2
>> server web04.dev 192.168.30.79:80 maxconn 32
>>
>>
>> The problem is, that only the first request si rewritten from
>> www04.devel.domain.com to www.devel.domain.com. All subsequent request
>>did
>> not pass the rewrite rule.
>>
>>
>> Please could some figure me out, where is the problem?
>Looks like you forgot "option http-server-close". This way HAProxy works
>in tunnel mode.
>Try to put it into
>--
>defaults
>..
> option http-server-close
>..
>
>
>
>> Best regards
>> Peter Hudec
>>
>cheers
>thomas