Forum Discussion
irule for selecting a node based on a url
We are doing some web hosting where customers come in on customer1.com, customer2.com, etc. We CNAME them to shared.hosting.com which has a corresponding wideIP. Can we have an irule that selects which node they connect to based on the incoming URL they provide? I saw this: https://devcentral.f5.com/questions/114-node-pool-select-according-to-domains-list and wanted to know if a datagroup could be the solution. Can you have more than one URL referenced in a data group to point to their individual nodes?
thanks in advanced.
The iRule and solution Kevin provided in that link looks to be exactly what you need. And yes, you can reference more than one URL in the data group to point to the same node.
- Cory_50405Noctilucent
The iRule and solution Kevin provided in that link looks to be exactly what you need. And yes, you can reference more than one URL in the data group to point to the same node.
- Eric_Hartwell_1NimbostratusI'm testing the solution and getting inconsistent results. Some URLs direct properly and others dont. I want customer1.com to be directed to node 10.10.15.1, customer2.com to be redirected to 10.15.15.1 and so on. each customer URL goes to its own node. The data group seems to work, but as I said, it's inconsistent. My data group looks like customer1.com := 10.10.15.1 80 customer2.com := 10.15.15.1 80 customer3.com := 10.15.16.1 80 My irule in place is when HTTP_REQUEST { if { [class match [string tolower [HTTP::host]] contains Shared_DataGroup] } { set my_node [split [class match -value [string tolower [HTTP::host]] contains Shared_DataGroup]] node [lindex $my_node 0] [lindex $my_node 1] } } suggestions are welcome.
- Cory_50405NoctilucentBy inconsistent results, do you mean some clients are getting directed to the incorrect node? Have you been able to determine whether all clients are having this issue or just certain ones?
- Eric_Hartwell_1Nimbostratusjust certain ones. I've only added 4 at this point. two work. two dont. the two that dont are identical format in the data group but when hitting them, I get redirected to a apache test page instead of the proper screen. Is there a way to see what node is being chosen and connected to? perhaps to a log file specific to this?
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