In general, having understood that yes how, I will describe the whole situation.

There is a CloudFlare. In his domain settings enabled Development Mode. But hardly CloudFlare here at all affects something.

Go ahead.

If you run the project in development mode, then everything is fine. Recompiles a resource if it was changed and the resource is successfully available at: http://site.ru/assets/application-md5-hash.css

If you run the project in production mode, then there’s some nonsense coming out. I have been dealing with this for several hours and have seen everything ... More in detail:

  1. I rake assets:precompile , which in turn generated everything I needed in the / public / assets directory. File names and hash in these names converge (source code in the browser + what is on the server).

  2. On the site itself, all scripts and styles have a mistake, they say, 404 - there is nothing here. For example, for this style: http://site.ru/assets/application-md5-hash.css . If you prescribe public to assets, it finds the style / script. But this does not solve the problem. Must be available at http://site.ru/assets/ .

  3. After a long time, I began to find a resource, but only application.css, application.js and global.js. But besides them, there are still personal styles / scripts such as, for example, news.css / js or comments.css / js. They still have 404 error.

  4. Next, I upgraded the version in assets.rb. Again executed rake assets:precompile . Everything returned to the starting point - all have 404 errors. There is nothing.

I touched absolutely nothing in production.rb. It was generated when creating a project - and it has lain until today. Besides, somehow, at the beginning of the project creation, I launched the project in production mode. And all the resources then loaded without problems.

How the damn fix it? Why such nonsense?

  • I'm definitely not sure, but ... I deleted the assets directory in public and the option in production.rb: config.assets.compile = true Started to work. That is, now it finds all the resources ... Can this be regarded as a framework bug? - Colibri
  • Heh. What are your connections to the application server going through? Only through CloudFlare, or is there still nginx on the way? - D-side
  • @ Button a bunch of Apache + Nginx along the way. But there is nothing illegal there. - Colibri
  • Hm That is, without CF, it works fine, as I understand it. And static gives nginx. - D-side
  • @ Buttons CloudFlare has nothing to do with it. In the first answer, I wrote what was possibly the problem. At least, as soon as I did it, everything became normal. - Colibri

0