Forum Discussion
Ben_Conrad_1026
Nimbostratus
Apr 05, 2006Simple iRule not working
Hi folks,
I am having a problem with a simple iRule, I am trying to do the following:
- mypool1 = www.company.com, has 1 node, virt. server is myvs1
- mypool2 = mystring.company.com, has 1 node, virt. server is myvs2
When a client requests http://www.company.com/mystring I want the clients base url to stay at www.company.com but the data will come from the nodes in the mypool2 servers.
when HTTP_REQUEST {
if { [HTTP::uri] contains "mystring" } {
pool mypool2
}
}
Initially, when I created this iRule the ltm complained with:
01070394:3: HTTP_REQUEST event in rule (myRule1)
requires an associated HTTP or FASTHTTP profile
on the virtual server (myvs1).
So I went into the myvs1 (and myvs2) virtual servers and changed the http profile to "http", this resolvd the error message however when I point a newly opened IE browser to www.company.com/mystring I get a 404 error. The interesting thing is that if I use the following iRule the uri string matches and I'm redirected to www.google.com:
when HTTP_REQUEST {
set uri [HTTP::uri]
if { $uri contains "mystring" } {
HTTP::redirect "http://www.google.com/"
}
}
Can somebody tell me what I'm missing in this setup?
Thanks,
Ben
2 Replies
- JRahm
Admin
MOst likely you are getting the 404 because mystring is a hook you've added for traffic management purposes, yet isn't a valid destination on your server. If this assumption is correct, you need to remove mystring once your condition is met:when HTTP_REQUEST { if { [HTTP::uri] contains "mystring" } { HTTP::uri "/" pool mypool2 } }
- Ben_Conrad_1026
Nimbostratus
That worked, thanks! I just looked at the web server logs and saw the "GET /mystring/". It's good to know that I should reset the uri for this setup, makes sense.
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