浏览器无法缓存 Rails 4 个站点的页面资产
Browser fails to cache page assets for Rails 4 Site
访问我们的 Rails 4 站点时,我们使用 Chrome 开发人员工具来查看我们的网络性能并监控各种资产的页面加载速度。这表明很少资产 were/are 被缓存。
诸如 application-.js 和 appliation-.css 文件之类的文件,我们肯定在页面加载之间没有改变,也没有被缓存。
在我们的 config/environments/production.rb 文件中,我们配置了以下内容:
# 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
关于为什么会发生这种情况有什么想法吗?谢谢
事实证明这是我正在测试的浏览器设置的问题。退出并重新启动浏览器,静态元素再次按预期缓存。
访问我们的 Rails 4 站点时,我们使用 Chrome 开发人员工具来查看我们的网络性能并监控各种资产的页面加载速度。这表明很少资产 were/are 被缓存。
诸如 application-.js 和 appliation-.css 文件之类的文件,我们肯定在页面加载之间没有改变,也没有被缓存。
在我们的 config/environments/production.rb 文件中,我们配置了以下内容:
# 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
关于为什么会发生这种情况有什么想法吗?谢谢
事实证明这是我正在测试的浏览器设置的问题。退出并重新启动浏览器,静态元素再次按预期缓存。