Forum Discussion
AndyC_86542
Nimbostratus
Sep 23, 2008Can an F5 route and use iRules on the same packet
I want to do something like this:
Check an http request for a specific cookie. If the cookie isn't there then respond with an http redirect. I can do this fairly easily using iRules.
...
hoolio
Cirrostratus
Sep 23, 2008I'd suggest creating a 0.0.0.0:80 VIP (wildcard vip on a specific port) with an HTTP profile. You should then be able to use a rule like this to check for the cookie:
when HTTP_REQUEST {
Check if the cookie exists
if {[HTTP::cookie exists "my_cookie"]}{
Use the proxy pool
pool proxy_pool
} else {
Redirect the client
HTTP::redirect "http://redirected.example.com"
}
}
You might want to try adding some kind of validation of the cookie value as the above example could be bypassed by a client manually inserting a cookie with the name.
Aaron
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
