DataScript: avi.http.remove_cookie_attribute


Function avi.http.remove_cookie_attribute([name],[cookie_attribute1], [cookie_attribute2],..)
Description This function removes the existing cookie attributes value in the HTTP response.
  • If the specified cookie attributes are present in an existing cookie, then the attributes are removed from the mentioned cookie.
  • If the specified cookie or cookie attributes do not exist, the function changes nothing.
Parameters The parameters are as follows:
Name:The name of the cookie to be modified.
attr:The attribute of the specified which has to be removed.
The attributes can be: path , domain , expires, maxage , httponly , secure , samesite
Returns None
Example Example 1:
Assume the server is sending a simple cookie with the name, path, and Domain
server cookie example: Set-Cookie: cookie_name=value; path=/dummy; To remove the path attribute, use
avi.http.remove_cookie_attribute("cookie_name", "path")
Set-cookie will be modified to Set-Cookie: cookie_name=value;
Example 2:
Consider scenarios like, request comes with path as /dummy1 then to remove the requested path from set-cookie, use
server cookie example: Set-Cookie: name=value; path=/dummy1;
If request comes with path = /dummy1 then remove path attribute from set-cookie

name, attr_tbl = avi.vs.get_cookie("name")
if attr_tbl[“path”] = “/dummy1“ then
    avi.http.remove_cookie_attribute("cookie_name", "path")