8

I am using the following output cache 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 app, 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 this extra Vary entry? This is preventing the cache from working correctly.

Any ideas how to fix this?

nakhli
  • 4,009
  • 5
  • 38
  • 61

2 Answers2

0

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

Also, just guessing here - does the config file differ between dev and 'live', e.g. varyByParam may be set differently?

Note: I've just joined SO so can't add comments just yet (which I would have done instead of posting this as a reply).

Appulus
  • 18,630
  • 11
  • 38
  • 46
  • Can't set varyByParam to None this will yield wrong results. No the varyByParam is set in the same way in dev and prod. The server is different though; dev server vs IIS. – nakhli Aug 06 '12 at 21:09
0

The Vary: Accept-Encoding header is inserted by the AppHarbor routing layer. The header is necessary to get downstream proxies (typically a CDN like AWS CloudFront or similar) to correctly cache both gzip'ed and non-gzip'ed versions of your content. This question has additional details.

Can you detail how this is causing problems for your application?

Community
  • 1
  • 1
friism
  • 19,068
  • 5
  • 80
  • 116
  • Vary star is inserted by the framework by default unless varyByParam="" is specified (notice that varyByParam="*" still generates vary star) see Atwood's answer here http://stackoverflow.com/a/486072/125804 . Worked around the problem. Will post the workaround here as answer. – nakhli Aug 06 '12 at 22:36