CodeShare
Have some code. Share some code.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner
The_Bhattman
Nimbostratus
Nimbostratus

Problem this snippet solves:

The following irule is a way to add a cookie header signifying a location of where the application is hosted. This can be used by CDNs such as Akamai that need to know the location of the requests if you have a distributed content hosting model.

Code :

when HTTP_REQUEST {
  set urihead [HTTP::host]
# set the value for location in the cookie
  set loc [HTTP::cookie "location"] 
}

when HTTP_RESPONSE {  
# checks to see if there is a west location or a no cookie value
# If you want to check if there is a east location
 if { $loc == "" } {
  HTTP::cookie insert name "location" value "west" 
  HTTP::cookie expires "location" 1209600 relative
  HTTP::cookie path "location" /
  HTTP::cookie domain "location" $urihead
 }
}
Version history
Last update:
‎18-Mar-2015 12:17
Updated by:
Contributors