Forum Discussion
mski_151743
Nimbostratus
Apr 23, 2014URI iRule Redirect Question
Hello,
I have the below customer request. I was wondering if the below iRule would handle the request properly. If it looks good I'll try it out on Monday. If you have any suggestions, pleas...
nitass
Employee
May 01, 2014shouldn't it be HTTP::query in HTTP::redirect (rather than HTTP::uri)?
HTTP::query
https://devcentral.f5.com/wiki/iRules.http__query.ashxe.g.
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "points" or [string tolower [HTTP::uri]] contains "abcd" } {
HTTP::redirect "https://points.website.com/?[HTTP::query]"
}
}
}
[root@ve11a:Active:In Sync] config curl -I http://www.website.com/points?icid=ABCD_PROMO_POINTS
HTTP/1.0 302 Found
Location: https://points.website.com/?icid=ABCD_PROMO_POINTS
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
mski_151743
Nimbostratus
May 01, 2014I was able to use all the iRule suggestions to come up with the below iRule to get the query redirect working. The customer is satisfied. I'm happy it works and happy that I learned a bit more about this type of iRule. Thanks again!
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "points" } {
HTTP::redirect "https://points.website.com?[HTTP::query]"
}
}
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