Skip to content

Commit

Permalink
Merge pull request #2915 from bitzesty/assets-cache-headers
Browse files Browse the repository at this point in the history
Set asset cache headers
  • Loading branch information
dreamfall authored May 10, 2024
2 parents b8f3795 + c188132 commit 472d26c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ yarn-debug.log*
/yarn-error.log
yarn-debug.log*
.yarn-integrity
/.vscode
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ GEM
PLATFORMS
arm64-darwin-21
arm64-darwin-22
arm64-darwin-23
x86_64-darwin-21
x86_64-darwin-22
x86_64-darwin-23
Expand Down
11 changes: 5 additions & 6 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = true # ENV['RAILS_SERVE_STATIC_FILES'].present?
config.public_file_server.headers = {
"Cache-Control" => "public, s-maxage=31536000, max-age=15552000",
"Expires" => 1.year.from_now.to_formatted_s(:rfc822),
}

# Compress JavaScripts and CSS.
config.assets.js_compressor = Uglifier.new(harmony: true)
Expand All @@ -40,7 +44,7 @@

# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX

# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
Expand Down Expand Up @@ -93,9 +97,4 @@

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

# AWS SES mail settings are in config/initializers/aws_ses.rb

# configure the devise email layout
# config.to_prepare { Devise::Mailer.layout "mailer" }
end

0 comments on commit 472d26c

Please sign in to comment.