Forum Discussion
Routing to individual pool member based on URI
Dev,
Looking to route to several backend ports on a server based on URI. My thoughts are creating one pool that references the server's four different ports, 8081-8084, and using a switch statement to route to the server's instances for each request. Something similar to the below statement is what I'm needing. I've tested the iRule, and it seems to be hitting the default pool, but not going to any of the other instances. I've tried */wfbild*, /wfbild* in the rule, but to no avail. Anything I'm missing in the rule? Also, I am SNAT'ing these, do I need to call that out in this rule or does the rule get processed and then the VS does it's own conditions after that? I took off persistence on this VIP as well so I don't think there's anything happening there. Any help would be greatly appreciated.
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
"/wfdevl" {
pool sis-workflow-dev.dev.uga.edu member 172.17.140.14:8081
}
"/wfbild" {
pool sis-workflow-dev.dev.uga.edu member 172.17.140.14:8082
}
"/wftest" {
pool sis-workflow-dev.dev.uga.edu member 172.17.140.14:8083
}
"/wftrng" {
pool sis-workflow-dev.dev.uga.edu member 172.17.140.14:8084
}
default {
pool sis-ssb-devl.dev.uga.edu_Pool
}
}
}2 Replies
- nitass
Employee
I've tried */wfbild*, /wfbild* in the rule, but to no avail.have you added -glob in switch?
iRules 101 - 04 - Switch by Joe Pruitt
https://devcentral.f5.com/tech-tips/articles/irules-101-04-switch
My thoughts are creating one pool that references the server's four different portsyou can use "node" command instead of pool. for node command, you do not need to define pool.
node
https://devcentral.f5.com/wiki/iRules.node.ashx - wixxyl_98682
Nimbostratus
Thanks Nitass, that was what I was needing. My finished rule ended up looking like this, in case anybody needs something similar in the future.when HTTP_REQUEST { switch -glob [HTTP::uri]] { "*/wfdevl*" { pool sis-workflow-dev.dev.uga.edu member 172.17.140.14:8081 } "*/wfbild*" { pool sis-workflow-dev.dev.uga.edu member 172.17.140.14:8082 } "*/wftest*" { pool sis-workflow-dev.dev.uga.edu member 172.17.140.14:8083 } "*/wftrng*" { pool sis-workflow-dev.dev.uga.edu member 172.17.140.14:8084 } default { drop log local0. "connection dropped from [IP::client_addr]" } } }
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