Forum Discussion
Samesite cookies on 1600's
- Feb 02, 2020
You cannot fix SameSite cookie issues on 11.6.x with LTM policies - the required feature are not supported.
You will need to use the irule suggested in that article.
However, if your pool members have addressed the SameSite cookie attributes, then that irule may not be needed.
If the BigIP is adding cookies to the response (persistence cookies, ASM cookies, APM portal cookies), then those cookies will not have the correct attributes set.
In this case, you need to that irule, but the event needs to be HTTP_RESPONSE_RELEASE
BigIP cookies are added after HTTP_RESPONSE (which is just the response from the pool member), so to modify the BigIP cookies, you need to change them just before the final response is released to the client.
when HTTP_RESPONSE_RELEASE { # Set-Cookie header can occur multiple times, treat as list set num [HTTP::header count Set-Cookie] if {$num > 0} { foreach set_cookie [HTTP::header values Set-Cookie] { # only modify if header does not have SameSite attribute set foundSameSite [string match -nocase "*SameSite*" $set_cookie ] if {[expr {!$foundSameSite} ]} { set set_cookie [concat $set_cookie "; SameSite"] } # collect modified and unmodified values in list newcookies lappend newcookies $set_cookie } if {$num == 1} { # overwrite existing HTTP::header replace Set-Cookie [lindex $newcookies 0] } else { # remove and replace HTTP::header remove Set-Cookie foreach set_cookie $newcookies { HTTP::header insert Set-Cookie $set_cookie } } } }
You cannot fix SameSite cookie issues on 11.6.x with LTM policies - the required feature are not supported.
You will need to use the irule suggested in that article.
However, if your pool members have addressed the SameSite cookie attributes, then that irule may not be needed.
If the BigIP is adding cookies to the response (persistence cookies, ASM cookies, APM portal cookies), then those cookies will not have the correct attributes set.
In this case, you need to that irule, but the event needs to be HTTP_RESPONSE_RELEASE
BigIP cookies are added after HTTP_RESPONSE (which is just the response from the pool member), so to modify the BigIP cookies, you need to change them just before the final response is released to the client.
when HTTP_RESPONSE_RELEASE {
# Set-Cookie header can occur multiple times, treat as list
set num [HTTP::header count Set-Cookie]
if {$num > 0} {
foreach set_cookie [HTTP::header values Set-Cookie] {
# only modify if header does not have SameSite attribute
set foundSameSite [string match -nocase "*SameSite*" $set_cookie ]
if {[expr {!$foundSameSite} ]} {
set set_cookie [concat $set_cookie "; SameSite"]
}
# collect modified and unmodified values in list newcookies
lappend newcookies $set_cookie
}
if {$num == 1} {
# overwrite existing
HTTP::header replace Set-Cookie [lindex $newcookies 0]
} else {
# remove and replace
HTTP::header remove Set-Cookie
foreach set_cookie $newcookies {
HTTP::header insert Set-Cookie $set_cookie
}
}
}
}
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com