> I've problem to rewrite cookie path and cookie domain in HAproxy; I've a
> Nginx configuration but I want to move from Nginx to HAProxy for this proxy
> pass.
Just for my curiosity, why removing nginx ???
> This is a Nginx config I want to replace:
>
> location /~xxx/ {
> proxy_cookie_domain ~.* .$site.it;
> proxy_cookie_path ~.* /~xxx/;
> proxy_set_header Host $site.it;
> proxy_pass http://192.168.1.2/;
> }
>
> I need same function of proxy_cookie_domain and proxy_cookie_path; I found
> this:
> http://blog.haproxy.com/2014/04/28/howto-write-apache-proxypass-rules-in-haproxy/
> but not work form me.
>
> Now I can change cookie path with:
> rspirep ^(Set-Cookie:.*)\ path=(.*) \1\ path=/~xxx/
It would be easier if you share a Set-Cookie header sent by your
application server.
In the mean time, you may use (add a 'if' statement if required):
http-response replace-value Set-Cookie (.*)\ path=.* \1\ path=/~xxx/
Note: now, prefer the http-response rule over the rspirep.
> I need add also domain, only if exists, but with dynamic hostname; I;ve
> tried with
>
> acl hdr_set_cookie_domain_and_path res.hdr(Set-cookie) -m sub domain=
> res.hdr(Set-cookie) -m sub path=
> rspirep ^(Set-Cookie:.*)\ path=(.*) \1\ path=/~xxx/;\ domain=%[hdr(Host)]
> if hdr_set_cookie_domain_and_path
This does not work like this.
You can use a request header in the response.
In 1.6, you'll be able to use variables.
In 1.5, you can use the capture during the request, then use the value
at response time.
capture request header Host len 32 # first capture statement has
capture.req.hdr id 0
acl hdr_set_cookie_domain res.hdr(Set-cookie) -m sub domain=
acl hdr_set_cookie_path res.hdr(Set-cookie) -m sub path=
http-response replace-value Set-Cookie (.*) \1;\
domain=%[capture.req.hdr(0)] # put your if statements as you want /
need
You can create as many http-response rules as you need to update first
the domain, then the path.
Baptiste
>
>
> Anyone can help me?
>
> Tnx,
> rr
>
> 2015-07-14 21:34 GMT+02:00 Baptiste <[email protected]>:
>>
>> Please repost your question. I can't see it in my mail history.
>>
>> Baptiste
>>
>> On Tue, Jul 14, 2015 at 3:33 PM, rickytato rickytato
>> <[email protected]> wrote:
>> > Anyone can help me? I keep using Nginx?
>> >
>> > 2015-07-07 10:46 GMT+02:00 rickytato rickytato
>> > <[email protected]>:
>> >>
>> >> 1.5.12
>> >>
>> >> 2015-07-06 17:58 GMT+02:00 Aleksandar Lazic <[email protected]>:
>> >>>
>> >>> Dear rickytato rickytato.
>> >>>
>> >>> Am 06-07-2015 15:32, schrieb rickytato rickytato:
>> >>>
>> >>>> Hi all,
>> >>>> I've problem to rewrite cookie path and cookie domain in HAproxy;
>> >>>> I've a
>> >>>> Nginx configuration but I want to move from Nginx to HAProxy for this
>> >>>> proxy
>> >>>> pass.
>> >>>
>> >>>
>> >>> Which Version of haproxy do you use?
>> >>>
>> >>> haproxy -vv ?
>> >>>
>> >>> Cheers Aleks
>> >>
>> >>
>> >
>
>