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

Stripping of caching headers prevents Rails stale?/ fresh_when method from working correctly #82

Closed
endymonium opened this issue Jun 1, 2014 · 6 comments

Comments

@endymonium
Copy link

Hi,

as all caching headers (HTTP_IF_MODIFIED_SINCE and HTTP_IF_NONE_MATCH) are stripped away in

env['HTTP_IF_MODIFIED_SINCE'] = ''
the internal Rails caching mechanism stops to work as intended.

Basically the stale? (http://apidock.com/rails/ActionController/Base/stale%3F) method will always return true. The result is the kind of odd behaviour, that the server regenerates the content, but correctly sets the return code to 304.

I wanted to use the mini profiler to check the impact of http caching in my application. I think this is especially an issue if you use the mini profiler also in production environments.

Jan

p.s. this discussion might also be interesting: rtomayko/rack-cache#24

@SamSaffron
Copy link
Member

This is by design, only for profiled requests, it only impacts admins.

If we let caching through you don't get correct results.

@ryana
Copy link
Contributor

ryana commented Aug 30, 2014

This behavior is super unintuitive. I just wasted 3 hours on it. I posit that having this "by design" is a mistake. The profiler should be just that: a profiler. It's presence shouldn't force more work on the application server. If you're an admin, and you're looking at the mini-profiler output, then you're savvy enough to go into your Inspector panel and clear the cache when you want to force the server to perform the work.

@SamSaffron
Copy link
Member

I am open to adding a config setting for this if you wish. PR welcome

@ryana
Copy link
Contributor

ryana commented Aug 31, 2014

Excellent! I'll whip something up.

@ryana
Copy link
Contributor

ryana commented Aug 31, 2014

Here you go! #96

@SamSaffron
Copy link
Member

closing this cause we have a setting for disabling cache busting now

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

No branches or pull requests

3 participants