Forum Discussion
Kevin_Leclercq_
Nimbostratus
Dec 05, 2005Irule to access individual web servers
We would like to implement the following if it is possible:
We go to www.website.com [192.168.1.100]
In BigIp VIP 192.168.1.100 points to pool: webfarm_80
Webfarm_80 Contains the following servers:
10.10.10.1:80 (webserver1)
10.10.10.2:80 (webserver2)
10.10.10.3:80 (webserver3)
10.10.10.4:80 (webserver4)
10.10.10.5:80 (webserver5)
We would like to create a rule so that if you specify something like: www.website.com/ip=10.10.10.1 it directs you to webserver1 if not specified you go to the pool: Webfarm_80. We would like to make this rule for all the servers in this pool. Please advise if this is possible and what the correct syntax would be. Thanks
We are currently running version 4.5.3 but are upgrading to 4.5.13 soon.
- Martin_MachacekHistoric F5 AccountKevin,
pool webservers { select node(findstr(http_uri, "ip=", 3, '/') + ":80") member 10.10.10.1:80 member 10.10.10.2:80 member 10.10.10.3:80 member 10.10.10.4:80 member 10.10.10.5:80 } virtual www.website.com:80 { use pool webservers }
pool all_webservers { member 10.10.10.1:80 member 10.10.10.2:80 member 10.10.10.3:80 member 10.10.10.4:80 member 10.10.10.5:80 } pool webserver1 { member 10.10.10.1:80 } pool webserver2 { member 10.10.10.2:80 } pool webserver3 { member 10.10.10.3:80 } pool webserver4 { member 10.10.10.4:80 } pool webserver5 { member 10.10.10.5:80 } rule server_switch { if(http_uri starts_with "/ip=") { if(http_uri starts_with "/ip=10.10.10.1) { use pool webserver1 } else if(http_uri starts_with "/ip=10.10.10.2) { use pool webserver2 } else if(http_uri starts_with "/ip=10.10.10.3) { use pool webserver2 } else if(http_uri starts_with "/ip=10.10.10.4) { use pool webserver2 } else if(http_uri starts_with "/ip=10.10.10.5) { use pool webserver2 } else redirect to "" } } else { use pool all_webservers } } virtual www.website.com:80 { user rule server_switch }
- Kevin_Leclercq_
Nimbostratus
I keep trying to add this expression to the "Node Select Expression" line but I am getting a "Error 331835 -- Rule string to tree failed. - syntax error at '{' line: 1 " every time. What exactly do I put in the Node select expression box? Thanks - Kevin_Leclercq_
Nimbostratus
Thanks - I am testing this on one of our QA BigIps before using it in production, I found a similar devcentral request and eventually put the following in the Node Select Expression Box: node(findstr(http_uri, "ip=", 3, '/') + ":80") This added without the error message. However, when I try to test it out it doesn't seem to be working. To test this I should be using: www.website.com/ip=10.10.10.1 (10.10.10.1 being the Node IP address of one of the pool members.) I set up a static page to verify what server I am hitting but when I put the full url/ip= info in I keep getting a Page Cannot be Found. Where am I going wrong? - Martin_MachacekHistoric F5 AccountKevin,
- Kevin_Leclercq_
Nimbostratus
I was able to get what you stated above working on the test BigIp, however there is a new wrench in the works. Here is the overview:
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