Forum Discussion
cookie insertion
when HTTP_REQUEST {
set uagent [string tolower [HTTP::header User-Agent]]
switch -glob [HTTP::host] {
if { [HTTP::uri] starts_with "/test" } {
HTTP::cookie insert name "ClassicView" value "mobile" path /
} else {
log local0. "no cookie set"
}
}
unset uagent
}
But the cookie is not set ???
I posted right before you...we need to do the cookie insert from the HTTP_RESPONSE event. Using it in the Request event inserts it between LTM and the pool members. I forgot my traffic flow for a second.
The example above your post should work. I can modify yours as well.
when HTTP_REQUEST {
set uagent [string tolower [HTTP::header User-Agent]]
switch -glob [HTTP::host] {
if { [HTTP::uri] starts_with "/test" } {
set cinsert 1
} else {
set cinsert 0
log local0. "no cookie set"
}
}
unset uagent
}
when HTTP_RESPONSE {
if { $cinsert eq 1 } {
HTTP::cookie insert name "ClassicView" value "mobile" path / }}
May I ask how you're using the uagent variable here? Is it for something separate from the cookie logic?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
