MVC3 OutputCache VaryByHeader=Cookie not being set

asp.net, asp.net-mvc-3

Solution

I hate IIS almost as much as I hate ASP.NET.

http://blogs.msdn.com/b/chaun/archive/2009/10/01/iis-compression-overwrites-the-vary-header-average-rating-0-ratings.aspx

Problem

I have the following action method: ``` [HttpGet, Authorize, OutputCache(Duration = 60, VaryByHeader = "Cookie", Location = OutputCacheLocation.Any)] public ActionResult Index() ``` But when I make a request, these are the headers issued: ``` Cache-Control: private, max-age=60, s-maxage=0 Content-Type: text/html; charset=utf-8 Content-Encoding: gzip Expires: Fri, 22 Jun 2012 09:56:32 GMT Last-Modified: Fri, 22 Jun 2012 09:55:32 GMT Vary: Accept-Encoding ``` Why isn't it including the Cookie header in the Vary? I've tried many variations of the `OutputCache` settings but to no avail :(

Original source