Forum Discussion
iRule - Redirect by query string from datagroup
Hi Support, I need your help to set iRule that will check string on the query from data group and if he exist we'll redirect to external url if not the traffic will go to internal pool
the request will be app.domain.com/?id=p0000&d=11111
the datadgroup should contain id's (string : p0000 )
Example :
when HTTP_REQUEST {
if { [string tolower [HTTP::query] ] contains "DGLIST" }
{ HTTP::redirect "http://app.domain.com[HTTP::uri]" }
else
{ pool app_pool }
}
This is OK ?
Thanks for the help!
3 Replies
- Stanislas_Piro2
Cumulonimbus
Hi,
First, Devcentral is not support. We are F5 users sharing our knowledge to other F5 users. I hope you will share your knowledge too.
if you want to filter on query string parameter id, you can use this code:
when HTTP_REQUEST { if { [class match [string tolower [URI::query [HTTP::uri]] id ] equals "DGLIST"] } { HTTP::redirect "http://app.domain.com[HTTP::uri]" } else { pool app_pool } }
- Lee_Sutcliffe
Nacreous
Almost, you just need to use
to lookup the DG:class match
when HTTP_REQUEST { if {[class match [string tolower [HTTP::query]] contains "dglist"]} { HTTP::redirect "http://app.domain.com[HTTP::uri]" } else { pool app_pool } }
- Rabbit23_116296
Nimbostratus
this wont work because DGLIST is in CAPS and you are calling the tolower method
Recent Discussions
Related Content
* 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