Forum Discussion
Roger_Grannum_7
Nimbostratus
Feb 23, 2007http and https redirect
I have version 4.6.4 and was having a hard time finding documentation on iRules. New to the process and was wondering how to create a rule 2 rules.
1) Have traffic that is going to http sent to one pool and https sent to another
2) Have a rule to take traffic with a specific URI http://www.mysite.com go to one pool and traffic for http://www.mysite.com/hell sent to a different pool.
If possible I would like a link to better documentation than the manual on F5 site for iRules on 4.X.
Thanks
Roger
4 Replies
- Roger_Grannum_7
Nimbostratus
I think I found the answer to the 2nd question:
For http://www.mysite.com
if (http_uri starts_with "/happy")
if (http_uri starts_with "/weird")
if (http_uri starts_with "/fun") {
use (partnersite_pool)
}
else {
use (mysite_pool)
}
So if they come in with http://www.mysite.com/happy they would go to the partnersite_pool else they would go to the mysite_pool.
Would this work??? - Martin_MachacekHistoric F5 AccountRoger,
your suggested rule is syntactically incorrect. Assuming that you really want to send request with URIs starting with "/happy" to partnersite_pool and the rest to mysite_pool, your rule should look like this:rule { if(http_uri starts_with "/happy") { use pool partnersite_pool } else { use pool mysite_pool } }
To answer your first question: HTTP and HTTPS requests are best separated by configuring separate virtual servers for port 80 (HTTP) and port 443 (HTTPS). Please refer to BIG-IP Reference Guide for details. Keep in mind that iRules cannot evaluate HTTPS requests unless the SSL connection is terminated (decrypted) by the BIG-IP. - Roger_Grannum_7
Nimbostratus
Very busy and now have time to re-address. I thought the script above was working but apparently not (they made changes to the code at the same time).
This is the rule I added:
if (http_uri starts_with "/ccr") {
use pool idg_affil_443
}
else {
use pool IDG_ReleaseY_80
}
When I go to the URL http://www.mysite.com/ccr.asp , it is not working. I checked again through the docs to see if I was missing something but could find anything. I am assuming once I apply the rule if take affect???? - Roger_Grannum_7
Nimbostratus
I keep copy from within the GUI so in the above examples ti doesn't show rule {
searched the forum and found some other examples but each one did not work.rule my_rule {
if (http_uri == "/ccr.asp"} {
redirect to "https://www.mysite.com" + http_uri
}
else {
use poll releaseY_80
}
}
I believe there is something I am missing!!!!!!!
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