Cloudfront supporting legacy CSS for Rails 3.2 application

I am running a Rails 3.2 application on Heroku. About a week later, we serviced the assets through CloudFront by setting config.action_controller.asset_hostCloudFront in our config / production.rb file on our URL. This worked successfully.

Last weekend I noticed that after the deployment on our site, our site looked very uncomfortable, and the reason is that it served outdated CSS. I looked at the css file that it was serving (using the validation element in Chrome) and the CSS was the application.css file with the md5 hash coming from CloudFront. I deleted the asset_host line (so that the assets will be serviced directly from our application) and deployed again (without changing any css), and noticed that the site that now looked great was serving application.css with another md5 hash.

It seems that for some reason, CloudFront was serving the old version of application.css, and I assume that this is due to the fact that our application informed the users browser about the operation of the old version of application.css.

To add another variable: we cache the home page and part of our layouts / application.html.erb file (which contains the style sheet tag), but each time we deploy, we clear the cache through Rails.cache.clear,

So, I think Rails.cache.clear might be invalid for caching. We use the dlli memcache client if this helps.

Any ideas or suggestions would be greatly appreciated!

Update:

I tried moving the CSS from the cached block and turning CloudFront back on, but the CSS still seems broken. Therefore, it is not related to header caching.

Update 2:

This seems to be a CloudFront problem, because when I check the item and change the CSS URL in our root domain (instead of the CDN domain), the CSS renders correctly.

md5-hash , , CloudFront CSS, CSS md5. ?

+4
1

CDN heroku. script heroku rake: , CDN. - .

- , , : Rails 3 Amazon CloudFront?

0

Source: https://habr.com/ru/post/1540166/


All Articles