Monday, May 18, 2015

Importance of Case-sensitivity of hostName attribute of Sites config node

Today, we faced a strange issue, which questioned my knowledge of Site Definition configurations in Sitecore :-D

One of my colleague had a Sitecore instance with site definition had hostnames defined.


<site name="website" hostname="" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" ... />

But, he had his IIS site defined with "xxx.local".

Even though hostname attribute is "", request to "xxx.local" works fine and match to the "website" site definition.

This made me confused as my knowledge said only request that should map to "website" site defition is request with same value as hostname attribute value.

I had a quick google search and found my thinking was correct.,-d-,config%20File.aspx

So, when Sitecore it self saying this, how is this not working accordingly is my next question.

Then, I found Jon West's following blog post about hostName setting, which explained the real issue with our setting.

Quote :
As a word of caution, in several cases I have seen where device resolution did not work as a developer expected, the issue was that their configuration used hostname (with a lowercase n in the attribute name) rather than hostName (with an uppercase N). Be sure to capitalize the N.

 After changing "hostname" to "hostName", everything started to work accordingly. :-)

No comments:

Post a Comment