Expand my Community achievements bar.

SOLVED

Dispatcher configuration examples - matching virtual hosts

Avatar

Level 1

In docs.adobe.com, Dispatcher Configuration, the following example regarding "Virtual Host Resolution" seems to be incorrect.

From: https://docs.adobe.com/docs/en/dispatcher/disp-config.html#Example Virtual Host Resolution

/farms   {   /myProducts     {     /virtualhosts       {       "www.mycompany.com"       }     /renders       {       /hostname "server1.myCompany.com"       /port "80"       }     }   /myCompany     {     /virtualhosts       {       "www.mycompany.com/products/*"       }     /renders       {       /hostname "server2.myCompany.com"       /port "80"       }     }   }

I would expect the following:

/farms { /myProducts { /virtualhosts { "www.mycompany.com/products/*" } /renders { /hostname "server2.myCompany.com" /port "80" } } /myCompany { /virtualhosts { "www.mycompany.com" } /renders { /hostname "server1.myCompany.com" /port "80" } } }

Can you please confirm the rules are inverted?

Thanks,

Claudio

1 Accepted Solution

Avatar

Correct answer by
Level 10

document is correct. Because evaluation is bottom up.

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

document is correct. Because evaluation is bottom up.

Avatar

Level 1

Hi Sham,

Got it. In this case I would expect the example to be:

/farms { /myCompany { /virtualhosts { "www.mycompany.com" } /renders { /hostname "server1.myCompany.com" /port "80" } } /myProducts { /virtualhosts { "www.mycompany.com/products/*" } /renders { /hostname "server2.myCompany.com" /port "80" } } }

No functional difference, only the correct farm names to improve the overall clarity of the example itself. Correct?

Avatar

Level 10

CLAUDIO RIVABENE wrote...

 

No functional difference, only the correct farm names to improve the overall clarity of the example itself. Correct?

 

agree & make sense.

Avatar

Level 1

The example in the documentation shows the following table:

Using this example, the following table shows the virtual hosts that are resolved for the given HTTP requests:

 

However, that does not seem to match up with what the documentation says (for the second request):

Dispatcher finds the best-matching virtual host value in the following manner:

  • The first-encountered virtual host that matches all three of the host, the scheme, and the uri of the request is used.
  • If no virtualhosts values has scheme and uri parts that both match the scheme and uri of the request, the first-encountered virtual host that matches the host of the request is used.
  • If no virtualhosts values have a host part that matches the host of the request, the topmost virtual host of the topmost farm is used.

For the second request, it seems the 2nd rule above would kick in, meaning that the www.mycompany.com/products/* would be the resolved virtual host (scheme and uri don't match any virtualhosts - unless www.mycompany.com is interpreted as www.mycompany.com/*). Since the evaluation is bottom up, the host would match on the last virtualhost. What am I missing?