Ruby on rails 浏览器无法缓存Rails 4站点的页面资源
在访问Rails 4站点时,我们使用Chrome开发者工具查看网络性能并监控各种资产的页面加载速度。这表明缓存的资产很少 诸如application-.js和appliation-.css文件之类的文件在页面加载之间没有改变,也没有被缓存 在config/environments/production.rb文件中,我们配置了以下内容:Ruby on rails 浏览器无法缓存Rails 4站点的页面资源,ruby-on-rails,ruby,apache,caching,browser-cache,Ruby On Rails,Ruby,Apache,Caching,Browser Cache,在访问Rails 4站点时,我们使用Chrome开发者工具查看网络性能并监控各种资产的页面加载速度。这表明缓存的资产很少 诸如application-.js和appliation-.css文件之类的文件在页面加载之间没有改变,也没有被缓存 在config/environments/production.rb文件中,我们配置了以下内容: # Code is not reloaded between requests. config.cache_classes = true
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_files = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Set to :debug to see everything in the log.
config.log_level = :info
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
有没有想过为什么会发生这种情况?谢谢。这是我测试的浏览器设置的问题。退出并重新启动浏览器,静态元素再次按预期缓存。这是我测试的浏览器设置的问题。退出并重新启动浏览器,静态元素再次按预期进行缓存