Send traffic from different url's to specific servers



I try to match specific URL's to specific servers. like this:        ---> server1 ---> server2 ---> server3

My rules at the moment:
Rule1: /"$/
Rule2: /^\/two/
Rule3: /^$/

Rule1 matched to server1 ( Sharepoint
Rule 2 matched to server2 ( sap
Rule 3 matched to server3 ( random web service

This works, but is able to access /two with But only should be able to do this
Is there any way to match a specific portion of a string?
I thought that /^$/ was read like this - ^ is start of match and $ is end of match, but it does not seem to work like that because that would mean that is not a match to rule 3. But it is :(

Hope you understand what i try to accomplish and can help. 


Nick Smylie Official comment

Hi Tso,

On your matching rules are you matching on Host Header or are you using the checkbox 'Include Host in URL'?  For your scenario you should be matching on Host Header for rule 1 and 3.  For Rule 2 you should you should leave the header field blank.  When left blank it matches the URL, and by this I mean anything after the .com or .org.

Another thing to take note is that your rule precedence might need to be looked at it.  This is going to be within the virtual service itself under advanced properties.  If rule 2 is higher then rule 3 it will match and not go any further and thus get the results you are experiencing right now.

Thomas Sorensen

Hi Nick,

Thank you very much. The problem was the order of the rules.

These rules and this order made it work as intended :)

Options - Header - Pattern
Ignore Case - Host - /
Ignore Case + Add Host - blank - /two/
Ingore Case - Host - /^xyz\.com$/
Ignore Case - Host - /^www\.xyz\.com$/

Another question i have is: The second rule i have" Ignore Case + Add Host - blank - /two/ " How come that this does not match
it is good that it doesn't but, from what i understand the "Add Host" option appends the hostname to the string så the request would be but still it does not match rule 2? 

Nick Smylie

Hi Tso,

If I understand you correctly that is a slight misconfiguration in itself.  The 'Add host' checkbox is there if you want to match a URL tied with a host name.  For example the match string would be...

It would match the whole string and not just the URL or the host name, but both together.