PROFILE::persist¶
Description¶
Returns the current value of the specified setting in the assigned
persistence profile.
Warning
Deprecated in BIG-IP Next v20.0.1
Syntax¶
PROFILE::persist mode <mode> <setting_name>
PROFILE::persist <setting_name>¶
- Returns the current value of the specified setting in the assigned persistence profile.
PROFILE::persist mode cookie cookie_name¶
- Returns a runtime error if a cookie persist profile isn’t defined on the virtual server. Use [Profile::exists persist cookie] to check if there is a profile.
- Returns a null length string if the cookie persist profile doesn’t have a cookie name set (which is the default)
- Returns the cookie name if the cookie persist profile has a custom cookie name set
Examples¶
This example is commented in the SameSite link in the sample code below.
when HTTP_RESPONSE_RELEASE {
set persist_cookie_dbg 1
set samesite_security "none"
if {not [PROFILE::exists persist cookie]}{
if {$persist_cookie_dbg}{log local0. "[IP::client_addr]:[TCP::client_port]: Exiting because there isn't a cookie persist profile on the VS"}
return
}
if {[set persist_cookie [PROFILE::persist mode cookie cookie_name]] ne ""}{
if {$persist_cookie_dbg}{log local0. "[IP::client_addr]:[TCP::client_port]: \$persist_cookie=$persist_cookie"}
} else {
set persist_cookie "BIGipServer[LB::server pool]"
}
if {$persist_cookie_dbg}{log local0. "[IP::client_addr]:[TCP::client_port]: Parsed persist cookie name=$persist_cookie"}
switch [string tolower $samesite_security] {
"none" {
HTTP::cookie attribute $persist_cookie insert "SameSite" "None"
HTTP::cookie secure $persist_cookie
}
"lax" -
"strict" {
HTTP::cookie attribute $persist_cookie insert "SameSite" $samesite_security
}
default {
if {$persist_cookie_dbg}{log local0. "[IP::client_addr]:[TCP::client_port]: Invalid SameSite attribute value ''. \
Needs to be one of None|Lax|Strict"}
}
}
if {$persist_cookie_dbg}{log local0. "[IP::client_addr]:[TCP::client_port]: Set-Cookie header values=[HTTP::header values {set-cookie}]"}
}
# Log examples:
# No cookie persist profile enabled on the virtual server:
<HTTP_RESPONSE_RELEASE>: 10.1.1.8:51193: Exiting because there isn't a cookie persist profile on the VS
# Default cookie persist profile enabled on the virtual server (no persist cookie name is explicitly defined)
<HTTP_RESPONSE_RELEASE>: 10.1.1.8:51215: Parsed persist cookie name=BIGipServer/Common/http_pool
<HTTP_RESPONSE_RELEASE>: 10.1.1.8:51215: Set-Cookie header values={BIGipServerhttp_pool=117506314.20480.0000; path=/; Httponly; Secure}
# Custom cookie persist profile enabled on the virtual server with a custom cookie name defined as "my_persist_cookie"
<HTTP_RESPONSE_RELEASE>: 10.1.1.8:51255: $persist_cookie=my_persist_cookie
<HTTP_RESPONSE_RELEASE>: 10.1.1.8:51255: Parsed persist cookie name=my_persist_cookie
<HTTP_RESPONSE_RELEASE>: 10.1.1.8:51255: Set-Cookie header values={my_persist_cookie=117506314.20480.0000; path=/; Httponly; Secure;SameSite=None}