iRule to rewrite Cookie path

Hi, any idea how I can use an iRule to rewrite a cookie path from the server response? I need to rewrite the set-cookie path in the response from path=/abc to path=/

Thanks in advance.

Regards,

Brian

May be this is what you are looking for:

https://devcentral.f5.com/wiki/iRules.ProxyPassV10.ashx

Hi PK, yes I looked at the proxypassV10 irule but couldn’t figure out what I need to do to make it work for the cookie path. I tried using the data group but that doesn’t change the cookie path for me.

Brian

Hi,

Here is an irule to rewrite cookie path. You can use the path you want instead of MyCustomPath

when HTTP_RESPONSE { set cookies [HTTP::cookie names] foreach cookie $cookies { set cookie_value [HTTP::cookie $cookie] set cookie_path "/MyCustomPass" HTTP::cookie remove $cookie HTTP::cookie insert name $cookie value $cookie_value path $cookie_path } }

BR.