Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching Response Headers #28

Open
LinuxDoku opened this issue Sep 8, 2014 · 9 comments
Open

Caching Response Headers #28

LinuxDoku opened this issue Sep 8, 2014 · 9 comments
Milestone

Comments

@LinuxDoku
Copy link

Hello,

is it possible to cache response headers which are set via custom ActionFilter's?

Our application has a ActionFilter which set's the Content-Range header by inspecting the view model. This header get's lost when donut caching is serving the site from cache.

Thank you!

@moonpyk moonpyk added this to the v1.3.1 milestone Oct 6, 2014
@migig
Copy link

migig commented May 23, 2015

@LinuxDoku We have a similar problem. We need to update a cookie, but the action is cached, so the cookie doesn't change. How did you solve your problem?

@LinuxDoku
Copy link
Author

We have no fix for this yet. ATM we`re sending a timestamp at the end of the url to disable the caching for this request.

Our trainee has implemented correct header caching in mvcdonutcaching but we had no time to code review this feature. He meant it was quite simple to develop - maybe you could give it a try.

@migig
Copy link

migig commented May 23, 2015

@LinuxDoku If / once you're comfortable sharing your code, that would be awesome. I'd try! clean it up and submit it as a PR to @moonpyk.

Been digging into the codebase myself, but don't have a clue where to begin.

@LinuxDoku
Copy link
Author

@irii could you commit your fix here on github? Thx, will bring some energy to the office on tuesday ;)

@migig
Copy link

migig commented May 23, 2015

@LinuxDoku @irii 😃 🍺

@ghost
Copy link

ghost commented May 23, 2015

@LinuxDoku
Copy link
Author

@irii nice code!

Simply adding the headers to the attribute (in a semicolon separated list) is enough?

[DonutCache(CachedHeaders = "Content-Range;x-cache-item")]

Can't wait to see this in Zion ;)

@migig
Copy link

migig commented May 23, 2015

@LinuxDoku @irii Ohhhh, OK, I think I understand what you did, please correct me if I'm wrong.

Your problem was that you are setting headers, but they are excluded from the cache. So your fix allows you to manually specify which headers to cache.

My problem is certain headers ARE cached, and I want them excluded. Specifically, cookies.

Your code is nice and useful though! 😃

@mahdi87gh
Copy link

Hi,
I need to force server for cache a ajax request different than normal request. I used this line of code and it works, but I need an equivalent code for donut. Is it possible?
[OutputCache(CacheProfile = "long", Location = System.Web.UI.OutputCacheLocation.Server, VaryByParam = "*", VaryByHeader = "X-Requested-With")]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants