Forum Discussion
neeraj_66310
Nimbostratus
Dec 13, 2007I need to remove host from url and send it to particular pool
I am novice for creating irule, Kindly help me out for below requirement:--
user make request for one of 3 urls as below:--
1)http://main.test.com
2)http://main.test.com/first.test.com
3)http://main.test.com/second.test.com
We need to create irule to fulfill below 3 requiremnent using one Irule:--
1)If uri contain first.test.com, then Big IP LTM should remove main.test.com from url i.e. make it
http://first.test.com and send request to pool_first(pool name)
2)If uri contain second.test.com, then Big IP LTM should remove main.test.com from url i.e. make it
http://second.test.com and send request to pool_second
(pool name)
3)else (otherwise) it should send request to poolmain
(pool name)
- You have left out a few details. What would you like done to the rest of the uri's (if they are present).
http://main.test.com/first.test.com/foo/bar
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/first.test.com*" { HTTP::header replace "Host" "first.test.com" HTTP::uri "/" pool pool_first } "/second.test.com*" { HTTP::header replace "Host" "second.test.com" HTTP::uri "/" pool pool_second } default { pool poolmain } } }
- neeraj_66310
Nimbostratus
Dear Joe, - neeraj_66310
Nimbostratus
Dear Joe, - neeraj_66310
Nimbostratus
Dear Joe, - neeraj_66310
Nimbostratus
Dear joe, - neeraj_66310
Nimbostratus
Dear joe, - neeraj_66310
Nimbostratus
Dear joe, - Glad to be of help. Just to let you know that we are not consulting here at DevCentral and would like to see our users put some effort in writing the iRules themselves to help you all be more self-sufficient. We are here to help out debugging and giving you guidance (and occasionally write functional iRules when the need arises).
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/first.test.com*" { HTTP::header replace "Host" "first.test.com" HTTP::uri "/" pool pool_first } "/second.test.com*" { HTTP::header replace "Host" "second.test.com" HTTP::uri "/" pool pool_second } default { pool poolmain } } }
set orig "/one/two/three/four" set stripped [string map { "/two" "" } $orig]
HTTP::uri [string map { "somval" "" } [HTTP::uri]]
- neeraj_66310
Nimbostratus
Thanks Joe, - No problem. Please feel free to post again if anything comes up.
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