Forum Discussion

Arthur_Chapin_1's avatar
Arthur_Chapin_1
Icon for Nimbostratus rankNimbostratus
Oct 13, 2005

iRule to rewrite cookie domain

Can an irule be used to rewrite a cookies domain by intercepting the HTTP response, I am super new to iRules but I assume it would look something like this, im just not sure how the syntax should be

 

 

when HTTP_RESPONSE {

 

set cookieDomain [HTTP::cookie domain]

 

if { $cookieDomain contains "domainA" } {

 

HTTP::cookie domain replace "domainA" "domainB"

 

}

 

}

 

 

Any help would be greatly appreciated

 

Thanks

 

Arthur

3 Replies

  • Try:

    
    when HTTP_RESPONSE {
      set cookieDomain [HTTP::cookie domain "cookiename"]
      if { $cookieDomain contains "domainA" } {
        HTTP::cookie domain "cookiename" "domainB"
    }
    }

    If you don't know the "cookiename" try "HTTP::cookie names".

    Not sure if this will work... got the info from here Click here

    -Brian
  • when HTTP_RESPONSE { 
       set newdomain "abc.com"
        foreach mycookie [HTTP::cookie names] { 
            HTTP::cookie domain $mycookie $newdomain
        } 
    }