Forum Discussion
Allan_66523
Dec 08, 2011Nimbostratus
redirect url to another pool
I would like to have 1 vip for about 50 virtual web nodes. I would like the irule to look at the url and direct it to the correct pool. Can someone help me with this?
Thanks
8 Replies
Sort By
- Would something like this work?
- Hi Allan,
when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "test.xzy.com" { pool test_pool } "hello.xzy.com" { pool hello_pool } "data.xzy.com" {pool data_pool } default { pool default_pool} } }
- How would I write this Irule if I wanted to send each url to a different VIP? So if the url contains test.xzy.com send it to the test.xzy.com vip and so on?
- there is a virtual command.
- so would it need to look something like this?
- e.g.
[root@ve1023:Active] config b virtual bar list virtual bar { destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve1023:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "test.xyz.com" { virtual test_vip } "hello.xyz.com" { virtual hello_vip } "data.xyz.com" { virtual data_vip } default { virtual default_vip } } } } [root@ve1023:Active] config b virtual test_vip list virtual test_vip { snat automap pool foo1 destination 1.1.1.1:80 } [root@ve1023:Active] config b pool foo1 list pool foo1 { members 200.200.200.101:80 {} } [root@ve1023:Active] config b virtual hello_vip list virtual hello_vip { snat automap pool foo2 destination 2.2.2.2:80 } [root@ve1023:Active] config b pool foo2 list pool foo2 { members 200.200.200.102:80 {} } [root@ve1023:Active] config b virtual data_vip list virtual data_vip { snat automap pool foo3 destination 3.3.3.3:80 } [root@ve1023:Active] config b pool foo3 list pool foo3 { members 200.200.200.111:80 {} } [root@ve1023:Active] config b virtual default_vip list virtual default_vip { snat automap pool foo4 destination 4.4.4.4:80 } [root@ve1023:Active] config b pool foo4 list pool foo4 { members 200.200.200.112:80 {} } [root@ve1023:Active] config curl -i http://test.xyz.com HTTP/1.1 200 OK Date: Mon, 12 Dec 2011 14:51:24 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT ETag: "4183e4-3e-9c564780" Accept-Ranges: bytes Content-Length: 62 Connection: close Content-Type: text/html; charset=UTF-8 This is 101 host. [root@ve1023:Active] config curl -i http://hello.xyz.com HTTP/1.1 200 OK Date: Mon, 12 Dec 2011 14:49:51 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Tue, 08 Nov 2011 12:26:29 GMT ETag: "4183f1-30-47e02740" Accept-Ranges: bytes Content-Length: 48 Connection: close Content-Type: text/html; charset=UTF-8 This is 102 host. [root@ve1023:Active] config curl -i http://data.xyz.com HTTP/1.1 200 OK Date: Mon, 12 Dec 2011 14:50:37 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Wed, 30 Nov 2011 05:42:33 GMT ETag: "418416-30-33ce6440" Accept-Ranges: bytes Content-Length: 48 Connection: close Content-Type: text/html; charset=UTF-8 This is 111 host. [root@ve1023:Active] config curl -i http://other.xyz.com HTTP/1.1 200 OK Date: Mon, 12 Dec 2011 14:49:07 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Wed, 30 Nov 2011 05:53:38 GMT ETag: "41841b-3e-5b717c80" Accept-Ranges: bytes Content-Length: 62 Connection: close Content-Type: text/html; charset=UTF-8 This is 112 host.
- Do I need to add "contains" into the irule so similar URL's with test.xyz.com/test/hello will get sent to the correct vip?
- Do I need to add "contains" into the irule so similar URL's with test.xyz.com/test/hello will get sent to the correct vip?we use HTTP::host, so test.xyz.com/test/hello will still match the "test.xyz.com" in switch.
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