Forum Discussion
HyperSl4ck3r_16
Nimbostratus
Sep 11, 2014Getting cookie value and using switch
Greetings,
I am trying to write an iRule that provides the client with a cookie that we can use to dictate behavior and possibly redirect the user if needed. This is going to be used so we can ensur...
HyperSl4ck3r_16
Nimbostratus
Sep 12, 2014I took into account the possibility of the variable not being initialized as well as not having a default switch. I re-wrote the rule as follows.
when HTTP_REQUEST {
set cookie_local [HTTP::cookie value Data_Locale]
switch $cookie_local
{
www1
{
set need_cookie 0
}
default
{
set need_cookie 1
}
}
}
when HTTP_RESPONSE {
switch $need_cookie
{
0
{
HTTP::cookie expires Data_Locale 1200 relative
}
1
{
HTTP::cookie insert name Data_Locale value www1
}
}
}
I am again running into the issue. It creates the cookie, but it will still not update the cookie upon a request. Is it something in my set variable that is causing issues?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects