Forum Discussion
irule - 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:9001 https://temo.abc.com/groups -> server:9002
I have no idea where or how to start, any suggestions welcome please.
3 Replies
- Michael_Jenkins
Cirrostratus
I 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
to just/users?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.?id=123to 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 { } } } - HHM_194359
Nimbostratus
Thanks, I will take a look and have a play round.
- HHM_194359
Nimbostratus
Thanks, I will take a look and have a play round.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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