Skip to content

Commit

Permalink
Downcase cache-control in generated env files
Browse files Browse the repository at this point in the history
Since 7.1, Rails supports using Rack 3 (and newly generated apps will
get it by default). However, newly generated apps are currently being
generated with configuration that does not follow the Rack 3 SPEC.

Rack 3 required all response headers be downcased, so this commit
downcases the cache-control headers in generated environment files.
  • Loading branch information
skipkayhil committed Aug 20, 2024
1 parent 9f9deaf commit fdcd9e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Rails.application.configure do
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
<%- end -%>
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
else
config.action_controller.perform_caching = false
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Rails.application.configure do
# loading is working properly before deploying your code.
config.eager_load = ENV["CI"].present?

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.headers = { "Cache-Control" => "public, max-age=3600" }
# Configure public file server for tests with cache-control for performance.
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }

# Show full error reports and disable caching.
config.consider_all_requests_local = true
Expand Down

0 comments on commit fdcd9e4

Please sign in to comment.