Forum Discussion
DJDX21_252164
Mar 17, 2016Cirrus
iRule to rewrite cookie domain to toplevel domain
I have to domains,
1. xyz.abc.com
2. xyz.abbc.com
Now when I am trying to change the domain of the cookie at the toplevel the below iRule isn't working.
when HTTP_RESPONSE {
set a ".abc.com"
set...
- Mar 18, 2016
Finally I was able to set the cookie domain to toplevel by using the following iRule. Cookies are set to toplevel domain now by using HTTP::host and comparing directly with the domain values I have. What do you think about the following iRule? Any flaws?
when HTTP_REQUEST { log local0. "Cookie names in received request: [HTTP::cookie names] from IP: [IP::local_addr]" set httphost [HTTP::host] } when HTTP_RESPONSE { foreach mycookie [HTTP::cookie names] { log local0. "Host : $httphost" if { $httphost ends_with ".abc.com" } { HTTP::cookie domain $mycookie ".abc.com" } elseif { $httphost ends_with ".abbc.com" } { HTTP::cookie domain $mycookie ".abbc.com" } else { log local0. "Not a single cookie domain matched :" } } }
Sylvain_85827
Mar 17, 2016Cirrus
So what gives the logging in your logs of:
log local0. "==> cookieDomain value is : $cookieDomain"`
$cookieDomain value is not the same as cookie name dumps. We need to be sure what there is in this variable.
- DJDX21_252164Mar 17, 2016Cirrus: ==> cookieDomain value is : : Not a single cookie domain matched : Nothing is getting in cookieDomian, but then how was it going in if block. Just fyi: when HTTP_RESPONSE { foreach mycookie [HTTP::cookie names] { HTTP::cookie domain $mycookie ".abc.com" } } This works perfect but nothing works when if is applied.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects