Need to route a URI to particular pool

Hi there

I have the following requirement and I know its achiveable on bigIP but I am not sure how to go about it. Basically, we want to use it as an intelligent router. we got a website ABC.NET which is running on a webserver. What we want to do is to copy this website on a new server with minor changes, use big-ip so that ABC.NET goes to the original server and ABC.NET goes to the new webserver.

Any help would be highly appreciated.

Kind regards

Hi Taimoor,

This is pretty easily done with iRules, so I have moved your post to the iRules forums so that you can gain the benefit of the iRules experts’ knowledge.

Good luck,

Don.

This should do the trick. Put your old server in pool1 and new server in pool2.

when HTTP_REQUEST { 
   switch -glob [HTTP::uri] { 
     "/abc*" {  
       pool pool1 
     } 
     "/xyz*" { 
       pool pool2 
     } 
   } 
 }

-Joe

Thanks a lot guys for your prompt replies.

Hi Guys

Sorry to bother you again. But I have a strange problem. Actually I have a question first before i come to my problem. When I create the virtual server, only one pool can be assigned to it. So how this iRule will work when it refers to two different pools, one of which is not configured in the setting.

Having said that, yesterday I gave it a go and it worked first time. This morning however, it stoped working and the websites were not loading. After some investigation I managed to find the cause. For some bizzare reason, the http profile was stoping the access to websites. I had to remove it and select none. but When I do that, I cant use iRule as it is dependant on http profile. Hence no routing. So atm I only got one website running for the server defined in the default pool.

Any ideas?

Kind Regards

Taimoor

The rule will be evaluated. If a URI starts with /abc, pool1 will be used. If a URI starts with /xyz, pool2 will be used. If the URI doesn’t match either option, the VIP’s default pool will be used. You could also specify the default pool using:

switch -glob [HTTP::uri] { 
 ... 
    default { 
       pool pool3 
    }

What were the symptoms of the problem? Do you see any errors in /var/log/ltm* from the period of the failure? Were you using the exact rule Joe posted above in this thread? If not, can you post the rule you were using?

Aaron

Hi Aaron

I think I have establish that the problem I am having is not related to iRule as I have disabled it but the problem is still there. As I mentioned earlier, there seems to be some settin in the default http profile which cause this issue. As soon as I select it, websites stop working. If I leave to “none”, it works fine (please refer to the file attached).

To access this website, users have to loggin to a completely different site. Once they are logged in, they click the link to reach this website (behind big-ip). The first connection is over “https” where secure token are exhanges between the servers and once authenicated, the users are directed over “http” to browse the website. It cannot be accessed directly and above process must be followed. In nutshell (according to web developer):

1) HTTPS Link on Browser page has token along with it

2) User clicks on that link

3) That link is pointing to our server page

4) Our Server pages uses the token to access a web service call

5) which validates this token and supplies data back

6) Then our server will redirect this to our home page.

This info may not related but I thought i’ll post it anyway.

I first thought it could be a firewall issue but as it is working fine without http profile enabled, I am really clueless.

Help plz

Regards

Taimoor

Can you post your VIP and HTTP profile settings? You can get this from the command line by running:

b virtual vip_name list

b profile http list

Aaron

Here are the settings as requested.

virtual seuk {

pool extweb01

destination 194.133.18.132:any

ip protocol tcp

}

profile http http {

basic auth realm none

oneconnect transformations enable

header insert none

header erase none

fallback none

compress disable

compress prefer gzip

compress min size 1024

compress buffer size 4096

compress vary header enable

compress http 1.0 disable

compress gzip memory level 8k

compress gzip window size 16k

compress gzip level 1

compress keep accept encoding disable

compress browser workarounds disable

compress cpu saver enable

compress cpu saver high 90

compress cpu saver low 75

response selective chunk

lws width 80

lws separator none

redirect rewrite none

max header size 32768

max requests 0

pipelining enable

insert xforwarded for enable

adaptive parsing enable

ramcache disable

ramcache size 100mb

ramcache max entries 10K

ramcache max age 3600

ramcache min object size 500

ramcache max object size 50K

ramcache ignore client cache control all

ramcache aging rate 9

ramcache insert age header enable

compress content type include

“text/”

“application/(xml|x-javascript)”

}

profile http http-acceleration {

defaults from http

ramcache enable

ramcache size 100mb

ramcache min object size 0

ramcache max object size 4194304

ramcache ignore client cache control all

}

profile http http-lan-optimized-caching {

defaults from http

oneconnect transformations enable

ramcache enable

ramcache size 10mb

ramcache max age 86400

ramcache min object size 0

ramcache max object size 2M

}

profile http http-wan-optimized-compression {

defaults from http

oneconnect transformations enable

compress enable

compress buffer size 131072

compress vary header enable

compress http 1.0 enable

compress gzip memory level 16k

compress gzip window size 64k

compress gzip level 1

response selective chunk

}

profile http http-wan-optimized-compression-caching {

defaults from http

oneconnect transformations enable

compress enable

compress buffer size 131072

compress vary header enable

compress http 1.0 enable

compress gzip memory level 16k

compress gzip window size 64k

compress gzip level 1

response selective chunk

ramcache enable

ramcache size 10mb

ramcache max age 86400

ramcache min object size 0

ramcache max object size 2M

}

profile http seu_http {

defaults from http

oneconnect transformations disable

header insert “X_CLIENT_IP:[IP::client_addr]”

header erase none

fallback none

response selective chunk

lws width 80

lws separator none

redirect rewrite none

max header size 32768

max requests 0

pipelining enable

insert xforwarded for enable

}

profile http seuk {

defaults from http

}

Which HTTP profile were you using when the traffic failed? Does it now fail 100% when you test with the HTTP profile enabled?

Do you have the VIP defined on any port for a particular reason? Is the only access to the VIP made via port 80? Are there non-HTTP requests going to the VIP? If there is non-port 80 traffic going to the VIP, you could resolve the issue by configuring another VIP on port 80 with the HTTP profile and iRule enabled.

Aaron

Hi Aaron

If I understood you correctly, I have created two VIP each for http and https. I am using the default http profile. I found out that the https VIP doesnt work with http profile hence cant install the irule (as iRule require http profile) . And because the initial connection is made over https, iRule cant kickin. Is there any way I can use http profile on https VIP or any other solution I can try?

Regards

Taimoor

Hi Taimoor,

I thought all the load balanced traffic through the BIG-IP was via HTTP. If you need to inspect the HTTP headers or content in an iRule, you must decrypt the HTTPS using a client SSL profile if the request is encrypted, and you need to add an HTTP profile to the VIP. Do you have a cert/key for the fully qualified domain name that resolves to the VIP? If so can you try testing with a client SSL and HTTP profile added to the HTTPS VIP?

Aaron

Hi Aaron

Correct me if I am wrong, I was under the impression that its only contents not the URI which gets encrpyted in SSL. On that assumption I thought the big-ip should be able to route the traffic to proper webserver base on uri.

Could you please send me or link up the instruction on how to install cert/key on a client ssl profile. Does it have to be client or server ssl profile?

Taimoor