Sanal_Babu
Apr 22, 2023Altostratus
Redirect all request except few path
Hi ,
I am lookin for an irule which should redirect all request to a URL except few based on below path.
/en/services/
/en/ajax/logout
/en/e-service-errors
All the request should redirected to https://stg.bbbb.com except the above ones.
Please note the URL https://stg.bbbb.com is configured in a different site not in the same F5 load balancer.
Tried lot of irule's but no luck. All the requests are redirecting to the new sites.
Please help.
Sanal_Babu Assuming the default pool that you would like to forward traffic to is associated to this virtual server the following iRule should do what you are looking for.
when CLIENT_ACCEPTED priority 500 { set DEFAULT_POOL [LB::server pool] } when HTTP_REQUEST priority 500 { set URI [string tolower [HTTP::uri]] switch -- ${URI} { /en/services/ - /en/ajax/logout - /en/e-service-errors { pool ${DEFAULT_POOL} } default { HTTP::redirect "https://stg.bbbb.com" } } }