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 ...
maximillean_953
Apr 07, 2014Nimbostratus
OK I solved it with
expires=[clock format [expr ([clock seconds]+86400)] -format "%a, %d %h %Y %T GMT" -gmt true];
So new one is ;
when HTTP_REQUEST {
if { [string tolower [HTTP::path]] starts_with "/cookies/set/" } {
set ckname "TESTROUTER"
set ckvalue [getfield [HTTP::path] "/" 4]
set cookie [format "%s=%s; path=/; expires=[clock format [expr ([clock seconds]+86400)] -format "%a, %d %h %Y %T GMT" -gmt true]; domain=%s" $ckname $ckvalue ".123.com"]
HTTP::respond 302 Location [HTTP::host] "Set-Cookie" $cookie
}
}
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