Skip to content

Commit 20ef7c3

Browse files
authored
Update production.rb template to provide example to exclude healthcheck from force_ssl redirect
Instructions for disabling specific endpoints from http-to-https redirects live in the SSL middleware: https://github.com/rails/rails/blob/fc4407eed00ed172e92798ae2a5d415b1134c26b/actionpack/lib/action_dispatch/middleware/ssl.rb#L20 The change follows the path-matching pattern already present for ignoring the healthcheck endpoint for config.host_authorization: https://github.com/rails/rails/blob/fc4407eed00ed172e92798ae2a5d415b1134c26b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt#L110
1 parent fc4407e commit 20ef7c3

File tree

1 file changed

+2
-0
lines changed
  • railties/lib/rails/generators/rails/app/templates/config/environments

1 file changed

+2
-0
lines changed

railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Rails.application.configure do
5858

5959
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
6060
config.force_ssl = true
61+
# Skip http-to-https redirect for the default health check endpoint.
62+
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
6163

6264
# Log to STDOUT by default
6365
config.logger = ActiveSupport::Logger.new(STDOUT)

0 commit comments

Comments
 (0)