Forum Discussion
maximillean_953
Apr 07, 2014Nimbostratus
Example Irule
Hi, I try to translate a content switching rule from netscaler to F5 Irule for migration which still keeps going on.
I need a rule that if first 2 path of uri /cookies/set/xyz
then rule does 302 ...
John_Alam_45640
Apr 07, 2014Historic F5 Account
This is untested.
Also see this page: https://devcentral.f5.com/wiki/iRules.HTTP__respond.ashxwhen HTTP_REQUEST {
if { [HTTP::uri] starts_with "/cookies/set" } {
set fmt "%d %b %Y %H:%M:%S %Z"
set expiry [clock format [clock seconds] -format $fmt]
set domain ".[getfield [HTTP::host] . 2].[getfield [HTTP::host] . 3]"
set testrouter [string trim [URI::path [HTTP::uri] 3] "/"]
HTTP::respond 302 -version 1.1 Set-Cookie "TESTROUTER=$testrouter; path=/; expires=$expiry; domain=$domain" Location "http://www.123.com"
}
}
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