开发者

Why does Rails sometimes create an asset cache with the wrong permissions?

开发者 https://www.devze.com 2023-03-08 04:04 出处:网络
I have an EC2 instance with the usual stack of Apache, Passenger, and Rails. The app is running in production, so Javascript files are cached into an all.js file.

I have an EC2 instance with the usual stack of Apache, Passenger, and Rails. The app is running in production, so Javascript files are cached into an all.js file.

Passenger is configured to pre-start the application instance using the PassengerPreStart directive.

On occasion, the all.js that is created by Rails in public/javascripts has the wrong permissions, 0600 for the deployment user. It's supposed to be 0640, so th开发者_Go百科at Apache can serve the files (they're in the same group, www-data).

Do you have any explanation as to why this is happening? Is there any issue known with PassengerPreStart and Rails' asset caching?


I'm pretty sure this is because of the timestamps that come after the assets. If you do a view source the numbers after the asset/files are a timestamp and I think the browsers get confused, or rails messes it up or something.

You change the default of the timestamp to an empty string but putting the following code somewhere in your Rails application.

/application.rb

ENV[RAILS_ASSET_ID] = ""

That will set it to an empty string. See how that goes.

0

精彩评论

暂无评论...
验证码 换一张
取 消