New 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 /select
lookup node address in class using query parameters
set cookie with encoded value as a redirect to "/"
exit now
end
if cookie detected
decode cookie
decrypt cookie
select node address
[disable this event]
else
reject traffic
end
Originally it would only run once as the event was disabled after the node service was selected for load balancing. Since you can only load balance per connection this is ideal. On further testing it was discovered if a person then selected a different service using /select in the same browser window it would not detect this as the event was disabled.
When we removed the event disable this fixed the problem. However it's now decrypting the cookie for every HTTP request when we really only want it to decrypt a cookie for a new request. So my question is how to achieve this. I can set a variable however that relies on the redirected page request coming through through the same TCP connection and I can't guarantee this.