Forum Discussion
HHM_194359
Nimbostratus
Mar 26, 2015irule - redirect URL to a port on a server
Hi, new to irules - new to any sort of scripting, need to achieve the following for an incoming VIP:
https://temp.abc.com/users?id=123 -> server:9000?id=123
https://temp.abc.com/trades -> server...
Michael_Jenkins
Cirrostratus
Mar 26, 2015I would start by checking out the iRule 101 set of articles to get an idea of how to write iRules.
To accomplish what you want, you'll want to use both HTTP::uri to update the uri (e.g. from
/users?id=123 to just ?id=123) and then you could either use the pool command and use separate pools with different node/port combinations, or use one pool with both and use the node command to specify which node to use (I'd recommend the pool method personally). The irules 101 links will have clarify some things.
to get started, you might use something like this:
when HTTP_REQUEST {
switch -glob --[string tolower [HTTP::uri]] {
"/users?id=*" {
pool POOL_NAME_1
HTTP::uri [string map -nocase {/users /} [HTTP::uri]]
}
"/trades" {
pool POOL_NAME_2
}
"/groups" {
pool POOL_NAME_3
}
default {
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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