Forum Discussion
TLBrown_220661
Nimbostratus
Oct 05, 2015Need help with pool selection based on URI
This rule doesn't show any syntax errors in the editor, but I am not getting traffic to the pools. The rule resides in the Common partition and points to the pools using a path structure:
when H...
Oct 05, 2015
Hi!
You can try this rule to see what's coming in:
when HTTP_REQUEST {
log local0. "Incoming URI: [string tolower [HTTP::uri]]"
switch -glob [string tolower [HTTP::uri]] {
"/accountsearchdev.somewhere.com/" { pool "/test-partition/accountsearchdev.somewhere.com-1080" }
"/maintenancedev.somewhere.com/" { pool "/test-partition/maintenancedev.somewhere.com-1081" }
"/passportnetdev.somewhere.com/" { pool "/test-partition/passportnetdev.somewhere.com-1082" log "Matched to passportnetdev.somewhere.com-1082" }
"/agentsearchdev.somewhere.com/" { pool "/test-partition/agentsearchdev.somewhere.com-1083" }
"/contracdev.somewhere.com/" { pool "/test-partition/contracdev.somewhere.com-1084" }
"/mftransferdev.somewhere.com/" { pool "/test-partition/mftransferdev.somewhere.com-1085" }
"/mfreportsdev.somewhere.com/" { pool "/test-partition/mfreportsdev.somewhere.com-1086" }
"/esignaturereportsdev.somewhere.com/" { pool "/test-partition/esignaturereportsdev.somewhere.com-1087" }
"/helpdeskdev.somewhere.com/" { pool "/test-partition/helpdeskdev.somewhere.com-1088" }
"/batchimportmgrdev.somewhere.com/" { pool "/test-partition/batchimportmgrdev.somewhere.com-1089" }
"/iprmdev.somewhere.com/" { pool "/test-partition/iprmdev.somewhere.com-1090" }
"/passportadmindev.somewhere.com/" { pool "/test-partition/passportadmindev.somewhere.com-1091" }
"/prevailintegrationdev.somewhere.com/" { pool "/test-partition/prevailintegrationdev.somewhere.com-1092" }
"/qivadmindev.somewhere.com/" { pool "/test-partition/qivadmindev.somewhere.com-1093" }
"/qivconfigdev.somewhere.com/" { pool "/test-partition/qivconfigdev.somewhere.com-1094" }
"/quotetracdev.somewhere.com/" { pool "/test-partition/quotetracdev.somewhere.com-1095" }
"/stratreportdev.somewhere.com/" { pool "/test-partition/stratreportdev.somewhere.com-1096" }
default { log "Request: [HTTP::uri] from [IP::client_addr] failed - no match in list" }
}
}
This rule only matches URI's that is an exact match.
Ie.
It will match but not
If you want to match you need to add a wildcard. Something like this:
when HTTP_REQUEST {
log local0. "Incoming URI: [string tolower [HTTP::uri]]"
switch [string tolower [HTTP::uri]] {
"/accountsearchdev.somewhere.com/*" { pool "/test-partition/accountsearchdev.somewhere.com-1080" }
"/maintenancedev.somewhere.com/*" { pool "/test-partition/maintenancedev.somewhere.com-1081" }
"/passportnetdev.somewhere.com/*" { pool "/test-partition/passportnetdev.somewhere.com-1082" log "Matched to passportnetdev.somewhere.com-1082" }
"/agentsearchdev.somewhere.com/*" { pool "/test-partition/agentsearchdev.somewhere.com-1083" }
"/contracdev.somewhere.com/*" { pool "/test-partition/contracdev.somewhere.com-1084" }
"/mftransferdev.somewhere.com/*" { pool "/test-partition/mftransferdev.somewhere.com-1085" }
"/mfreportsdev.somewhere.com/*" { pool "/test-partition/mfreportsdev.somewhere.com-1086" }
"/esignaturereportsdev.somewhere.com/*" { pool "/test-partition/esignaturereportsdev.somewhere.com-1087" }
"/helpdeskdev.somewhere.com/*" { pool "/test-partition/helpdeskdev.somewhere.com-1088" }
"/batchimportmgrdev.somewhere.com/*" { pool "/test-partition/batchimportmgrdev.somewhere.com-1089" }
"/iprmdev.somewhere.com/*" { pool "/test-partition/iprmdev.somewhere.com-1090" }
"/passportadmindev.somewhere.com/*" { pool "/test-partition/passportadmindev.somewhere.com-1091" }
"/prevailintegrationdev.somewhere.com/*" { pool "/test-partition/prevailintegrationdev.somewhere.com-1092" }
"/qivadmindev.somewhere.com/*" { pool "/test-partition/qivadmindev.somewhere.com-1093" }
"/qivconfigdev.somewhere.com/*" { pool "/test-partition/qivconfigdev.somewhere.com-1094" }
"/quotetracdev.somewhere.com/*" { pool "/test-partition/quotetracdev.somewhere.com-1095" }
"/stratreportdev.somewhere.com/*" { pool "/test-partition/stratreportdev.somewhere.com-1096" }
default { log "Request: [HTTP::uri] from [IP::client_addr] failed - no match in list" }
}
}
Hope that helps.
/Patrik
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