Static Content not cached properly in Dynamics CRM due to Vary:* header

Recently I have worked on a few different performance cases where the customer was either seeing slow form load performance or noticed high bandwidth usage. To see what was happening I gathered a fiddler trace and looked at the traffic. When gathering a fiddler trace I always open the form twice in a row to make sure static content has a chance to get cached. On any subsequent page loads we should only see dynamic pages being loaded. This would include aspx, asmx, ashx, and svc type of requests. However in this scenario I would see large JavaScript files being loaded each time I open the form.

I have a couple screenshots below showing the common offenders. These static files can account for nearly 1MB of extra data being downloaded with each form load. On a slower network connection it can add several seconds to the page load. 



These static files all have caching set to public however the Vary header in the response was being set to “*”. Anytime the Vary header is set to * it will prevent the client from caching the file.  The Vary header should be set to “Accept-Encoding”.  I have found a couple different culprits that cause this issue.

Issue 1: IIS is setting the Vary header to “*”.

In some cases IIS can set the Vary header to “*” instead of “Accept-Encoding”. I have primarily noticed this behavior on Windows Server 2012.  This can be easily prevented by changing the omitVaryStar IIS setting to True.   There are quite a few articles that can provide more detail on the omitVaryStar  setting, but this is something to look at if you are seeing the behavior.

Below are steps on how to change this setting

1. Select CRM site, and go to Configuration Editor.


2. Select system.web/caching/outputCache as Section, set True for omitVaryStar, click Apply to save the change.


This results in the Vary header in the response going back to “Accept-Encoding” and the browser is able to cache the static content properly.


Issue 2: Caching Features on Network Appliances adding Vary:* header.

There have been some scenarios where I’ve found that the Vary header was being impacted by network appliances.  In those cases the network appliances had their own caching or compression functionality which caused the Vary * header to be added. I’ve seen this behavior caused by Load Balancers, Firewalls, and Proxy Servers. These can be a little harder to track down, but in some cases you can access a server directly using IP or server name to see if the issue is still occurring. Once the source was identified the customer would either update the appliance configuration or disable the appliance caching functionality because it did not add noticeable benefit over what IIS was doing.

There may be other things that cause this behavior, but these are the two common things that I run into.  Feel free to drop a comment if you have seen other root causes to the behavior.


Jeremy Morlock

Microsoft Premier Field Engineer

Comments (7)

  1. Brian Bakke says:

    Great post, Jeremy – I've used this to identify that the omitVaryStar setting was the culprit in a couple perf scenarios as well.

    Have you seen similar behavior in a CRMOL case that this behavior had anything to do with client settings?

    Thanks –


  2. JMorlock says:

    Hi Brian,

    I have not seen client settings affect how the Vary header is set in on the server responses. There are browser settings that will not allow files to be cached, or will remove cached files when browser was closed.

    The files that are valid for caching should show up in fiddler with Vary set to Accept-Encoding and the caching is set to public with a future expiry date. If those files get downloaded with each page load then it would signify that something client site is preventing the caching.  In that case you could look at some of the following settings.

    – Is enough Disk Space Allocated for Temporary Internet Files.

    – Is browser set to Empty Temporary Internet Files When Browser is Closed, when logging out, or restarting.

    – Is the browser allowed to Save Encrypted Files To Disk.

    These settings can be found in IE Internet Settings under the General and Security Tabs. Other browsers will have similar settings available. In some environments these settings are maintained by Group Policy and can't be configured client side.



  3. SUDHIR NORY says:

    I see that the value is already set to 'True' for omitVaryStar IIS setting in CRM 2015 and Windows 2012

    Is this by design in the new version?

  4. KC Christensen says:

    I think that setting is default on IIS w/in 2012.  I have seen the default settings as true since IIS 7.x.

    A second question however:   Can we change the type and duration of dyanmic and static caching w/in CRM and not killing the deployment?

  5. Gary says:

    Thanks for this Jeremy. Can you explain why aspx, asmx, or ashx pages should not be cached? In the case of CRM 2011, the global.ashx is 330KB and is published with a version number. It doesn’t seem to change, and presumably if it did it would have a new version number and therefore refresh from the server. So why download it every time?
    Appreciated in advance.

  6. Patrick Malbois says:

    Is this setting also to change for CRM 2016 ?

  7. AAToledano says:


    Is this still valid for Dynamics 365?


Skip to main content