Forum Discussion
need help to create an irule to append an uri and redirect with conditions...
Hey guys, thank u soo much for your efforts. really appreciate it. U guys do a great job. I was finally able to fix it, but using HTTP class profiles (even though I felt I cud hav done it with iRules). I'll explain how. Rap was correct, the first iRule was perfect, except the fact that /test2 was not available on the server. so basically, the issue was solved right then, but not yet, there was a twist. the requirement was that when users try abc.test.com/test2, it shud go to pool-2222 re-written as abc.test.com, and nothing else. So I tried modifying the iRule as below, but it didn work.
when HTTP_REQUEST {
switch [string tolower [HTTP::path]] {
"/" {
HTTP::path "/test1"
pool pool-1111
}
"/test1" -
"/test1/" {
pool pool-1111
}
"/test2" -
"/test2/" {
[string map {"/test2" ""} [HTTP::path]]
pool pool-2222
} default {
pool pool-1111
}
}
}
Am sure there's a loop hole in the above rule but dunno what is that. And again it didn work for /test2 but this time it was returning webpage not available. pls suggest and lemme know what was wrong in the above rule.
Eventually I applied the concept to HTTP Class Profiles and created two profiles: 1 which matched only URI path "/" and redirected to http://[HTTP::host]/test1 2 which matched only URI path "/test2" and sent to pool-2222, re-writing the URL as http://[HTTP::host] I mapped the above 2 class profiles to Virtual server and it works. But thr's still an issue. it works only sporadically. 😞
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