Vary: * incorrectly added to HTTP header response (asp.net mvc3)

I use the following cache output profile:

<add name="MyFunkyProfile" duration="180" varyByParam="*" location="ServerAndClient" /> 

In dev, I have a response header with one Vary entry:

 HTTP/1.1 200 OK Server: Microsoft-IIS/7.5 ... Vary: Accept-Encoding Cache-Control: private, max-age=180, s-maxage=0 ... 

When I deploy my application, I have an extra Vary entry inserted in the response:

 HTTP/1.1 200 OK Server: nginx ... Vary: Accept-Encoding Cache-Control: private, max-age=180, s-maxage=0 ... Vary: * ... 

Why is this extra Vary entry? This prevents the cache from working properly.

Any ideas how to fix this?

+7
source share
2 answers

Have you tried setting varyByParam to None in your profile / configuration file? See http://msdn.microsoft.com/en-us/library/hdxfb6cy.aspx .

Also, just guessing here is whether the configuration file is different between dev and 'live', for example. can varyByParam be set differently?

Note. I just joined SO, so I can’t add comments yet (what would I do, and not post this as an answer).

0
source

The Vary: Accept-Encoding header is inserted by the AppHarbor routing layer. The header is required to access proxy servers (usually a CDN, for example, AWS CloudFront or similar) to properly cache both gzip'ed and non-gzip'ed versions of your content. This question contains additional information .

Can you explain how this causes problems for your application?

0
source

All Articles