Difference between revisions of "Cookies replacement"

From Tech-Wiki
Jump to: navigation, search
(Created page with "Category:F5 Networks '''Back to iRules''' # Rename a cookie by inserting a new cookie name with the same value as the original. Then remove the ol...")
 
Line 2: Line 2:
 
'''[[F5 Networks#iRules|Back to iRules]]'''
 
'''[[F5 Networks#iRules|Back to iRules]]'''
  
# Rename a cookie by inserting a new cookie name with the same value as the original.  Then remove the old cookie.
+
# Rename a cookie by inserting a new cookie name with the same value as the original.  Then remove the old cookie.
 
  when HTTP_REQUEST {
 
  when HTTP_REQUEST {
 
   # Check if old cookie exists in request
 
   # Check if old cookie exists in request

Revision as of 17:02, 20 May 2019

Back to iRules

# Rename a cookie by inserting a new cookie name with the same value as the original.  Then remove the old cookie.
when HTTP_REQUEST {
 # Check if old cookie exists in request
 if { [HTTP::cookie exists "old-cookie-name"] } {
   # Insert a new cookie with the new name and old cookie's value
   HTTP::cookie insert name "new-cookie-name" value [HTTP::cookie value "old-cookie-name"]
   # Remove the old cookie
   HTTP::cookie remove "old-cookie-name" 
  }
}