Forum Discussion

tacobell_112236's avatar
Icon for Nimbostratus rankNimbostratus
Mar 07, 2012

Irule redirect to seperate link if user or ip is new

Hello All- I'm being asked to utilize the F5 to redirect all new users or new IP that hit our site to a separate page while at the same time allowing current users ( or those that have visited already) to continue on to the existing url -----is this possible??




---this is really generic



when CLIENT_ACCEPTED { log local0. "Client IP Address: [IP::client_addr]" set groupvalue [class match -value [IP::client_addr] equals address.datagroup.list ] set defaultpool "" log local0. "Group Value: $groupvalue" switch $groupvalue { "groupa" { set destination "" } "groupb" { set destination "pool.two" } "groupc" { set destination "pool.three" } default { set destination $defaultpool } } if { [active_members $destination] < 0 } { log local0. "Destination Pool: $destination" pool $defaultpool } else { log local0. "Destination Pool: $destination" pool $destination } }

1 Reply

  • Hi tacobell,



    Is this for HTTP traffic? How do you want to track whether a user has accessed the site before?



    I could see doing this per browser session. Tracking the client IP wouldn't work for clients behind a proxy. Tracking the client IP or other client identifiers on LTM itself wouldn't be sustainable over long periods of time as it would require a lot of memory.



    If you wanted to do this using a cookie, you could set it in HTTP_RESPONSE using HTTP::cookie insert if the client didn't already have the cookie in the request. In HTTP_REQUEST you'd check for that cookie and select a different pool for the new sessions. Depending on how the servers in the "new pool" are configured, you might need to rewrite the requested URI to something they'd respond to with content. It might be easier to host the content on LTM and send it in reply to requests from "new" clients along with a cookie indicating they're not new anymore. Within that content, you'd want some option for the client to resend their original request or redirect them to the start of the application so they could continue their browsing.