Blobcache will not work if the request url is not in the Alternate Access Mapping list

There are scenarios on which you can access a unique site collection using different URLs even if these URLs are not listed in the Alternate Access Mapping (AAM) of the application. This normally does not cause any problem and even though you should not, you can live without adding DNS/Netbios aliases to AAM. If you plan to use blob cache, however, make sure that you list all URLs you may think of in the AAM.

One probable and common scenario is that on which you have multiples Web Front End (WFEs) and they are reached via Network Load Balancer (NLB). You did not add any host header when you created the web application and yet you can access the web application using both the local server name (eg. MOSS-WFE01) or the DNS entry (eg. https://myportal.contoso.com). However, when you add blob cache functionality to the site (see how to do this here), the cache does not seem to (and actually does not) work.

It happens because blob cache serving and caching happens in a level above SharePoint. It relies on the class HttpApplication rather than WebApplication. If necessary it goes to SharePoint to get the content and cache or just skip the file. If the file is already cached it retrieves from the file system rather than via SharePoint. At some point the blob cache trims the resource accordingly to user permission. At this point SharePoint has to be inquired and if part of the URL containing the web application is not in the AAM, SharePoint will assume the user has no rights and will not return anything at all.

How to verify if I am using the correct Alternate Access Mapping in my Network Load Balancer

Knowing the exact host header coming from the NLB is not so easy. Depending on the configuration, the NLB may use just an IP address or a FQDN. In order to find out do the following.

1. Enable IIS logging by selecting Web Sites, right-clicking and choosing properties.

image

2. In Properties/Advanced make sure Host (cs-host) is enabled.

image

3. Clear the cache in the web browser in any workstation (make sure the request will go through the NLB) and hit a couple of pages to populate the log

4. Navigate to the log file in the server you made the change (normally c:\windows\system32\LogFiles) and fin the latest file. You will something like this (in this example cs-host = team.learning.local):

image

5. Make sure the host header is listed in the Alternate Access Mapping (Central Administration | Operations | Alternate Access Mapping | Edit Public Url | Choose Web Application):

image

*** UPDATE: I submitted this blog entry as KB and it was published here:

https://support.microsoft.com/kb/2000283

 

*** UPDATE 2: See this article for instructions on how to add log fields in IIS 7.x

https://technet.microsoft.com/en-us/library/cc754702(WS.10).aspx