Location Via Cookie Header
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 } }
Published Mar 18, 2015
Version 1.0The_Bhattman
Nimbostratus
Joined October 14, 2005
The_Bhattman
Nimbostratus
Joined October 14, 2005
No CommentsBe the first to comment