aspnet/ResponseCaching

Users are able to make site throw an exception when using ResponseCaching middleware.

Bartmax opened this issue · 5 comments

using the ResponseCachingMiddleware with VaryByQueryKeys

[ResponseCache(CacheProfileName = "DefaultCache", VaryByQueryKeys = new string[] { "id" })]

open chrome inspector
tick disable cache
go to page that uses a ResponseCache with VaryByQueryKeys

image

it throws:
InvalidOperationException: 'VaryByQueryKeys' requires the response cache middleware.

closing the inspector or untick disable cache work fine.

Using fiddler, adding Pragma: no-cache header is enough to make the site throw an exception.

Confirmed here.

capture

We're hitting this issue in production - as reported by App Insights:

image

Looks like incognito mode on safari render the actions with VaryByQueryKeys useless too.

dupe of #81

Yes this is a duplicate of #81, please use the workaround provided there.