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...
Dec 13, 2007
You have left out a few details. What would you like done to the rest of the uri's (if they are present).
For example, how would you like this routed?
http://main.test.com/first.test.com/foo/bar
Would you want the rest of the URI (/foo/bar) stripped off and just change the host header ot first.test.com and send a blank URI ("/")? If so, this should do what you want.
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
}
}
}
You may need to change the "HTTP::uri" assignment lines depending on what you want to do with the URI's. You could omit it and it would send the original URI's on to the server, you could keep it as-is and it will send an empty URI ("/"), or you could do some string mapping to remove the host value from the URI and send whatever originally in it.
Hopefully this gives you something to run with...
-Joe
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