I ran a performance tool on my production environment and It says "Leverage browser caching for the following cacheable resources". It includes css, js, svg,...
based on your documentation it doesn't need any configuration for production. Is there a way to enable browser caching ?
This is more of a general Rails issue than webpacker related.
I'm assuming you're serving the assets with Rails. If so, you can control the cache headers by adding this to config/environments/production.rb:
config.public_file_server.headers = {
"Cache-Control" => "public, s-maxage=31536000, max-age=15552000",
"Expires" => 1.year.from_now.to_formatted_s(:rfc822)
}
thanks @grk
Closing...
Most helpful comment
This is more of a general Rails issue than webpacker related.
I'm assuming you're serving the assets with Rails. If so, you can control the cache headers by adding this to
config/environments/production.rb: