-
Notifications
You must be signed in to change notification settings - Fork 62
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
Cache-Control header not set in Rails 5 #39
Comments
I have the same issue with Rails 5.1 |
There was a fix for this at the end of April, but a new release wasn't made. Are you two downloading the gem straight from this repository? |
If the git version fixes this issue, I'll go ahead and release an update. |
I think it's still not fixed. I thought it was, because the header is correct when I request a file with I just tried the fork from PR #40 by @bookwitty and it has problems as well. The header is set as a hash. In other words, this line: results in this header: |
15 days ago I tried from the repo and the released version but had no success. Cache control was always stuck to 24 hours. |
@benoitongit Try adding this in config/initializers/heroku_deflater_patch.rb: module HerokuDeflater
class CacheControlManager
def cache_control_headers
if rails_version_5?
app.config.public_file_server.headers
else
app.config.static_cache_control
end
end
end
end |
* Cache-Control header not set in Rails 5 Fixes #39 * Simplify cache_control_headers and don't override other headers
@romanbsd can you please update it on Rubygems? |
Seems like this still never actually made it into a release? |
Rubygems version hasn't been updated since January 2017 (version 0.6.3). Use the following to use the github version: |
The issue is that commit f4d5b4c while fixing one thing, broke another, and also the specs are failing. I hadn't had time to look into it, and then forgot about it completely. If someone is willing to check, I'll be more than happy to receive a PR and release a new version. |
I'm having trouble overwriting the Cache-Control header in my Rails 5 app. I have the following in my
/config/environments/production.rb
file:This is applying to binary images fine (JPG/PNG/GIF) but JS and CSS assets still have the default max age of 86400 being applied (
public, max-age=86400
)How am I able to update that? Is the configuration setting above not supposed to apply to those files as well?
I've tried specifying the gem using the GIT url directly as I noticed a fix for this recently. This did not change anything.
When I enable them gem in development I see
max-age=31536000
set, however I don't seem to be able to update that either if I try a different value indevelopment.rb
and clear caches and restart servers.The text was updated successfully, but these errors were encountered: