Forum Discussion
Kevin_Davies_40
Nacreous
Apr 08, 2017New launch inside existing connection
The following pseudo code of an actual iRule is designed to set a cookie with address of the backend service. Once set it then serves them the service through the virtual server. if uri path is ...
Kai_Wilke
MVP
Apr 09, 2017Hi Kevin,
You may take a look to the iRule below.
The iRule uses an extended control structure to detect if the previous HTTP request on the same connection had used the same HTTP cookie value. If the cookie value is the same, the cookie decodings/decryptions/node selections can be savely skiped to reduce CPU overhead.
when CLIENT_ACCEPTED {
set last_cookie ""
}
when HTTP_REQUEST {
if { [HTTP::path] eq "/select" } then {
Compute cookie
Redirect while injecting cookie
} else {
if { $last_cookie eq "X[HTTP::cookie value "MyCookie"]" } then {
Skip cookie parsings and node selection
} elseif { [HTTP::cookie value "MyCookie"] ne "" } then {
Decode Cookie
Decrypt Cookie
if { $decrypted_cookie ne "" } then {
Select Node
set last_cookie "X[HTTP::cookie value "MyCookie"]"
Note: Dont remove the X. Its not a typo, but very important! :-)
} else {
reject
}
} else {
reject
}
}
}
Cheers, Kai
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