Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update production.rb template to provide example to exclude healthcheck from force_ssl redirect #51680

Merged
merged 1 commit into from Apr 28, 2024

Conversation

bensheldon
Copy link
Contributor

@bensheldon bensheldon commented Apr 28, 2024

Motivation / Background

This PR updates the production.rb template to provide an example for excluding the healthcheck from force_ssl redirect.

Instructions for disabling specific endpoints from http-to-https redirects live in the SSL middleware:

# config.ssl_options = { redirect: { exclude: -> request { /healthcheck/.match?(request.path) } } }

The change follows the path-matching pattern already present for ignoring the healthcheck endpoint for config.host_authorization:

# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • X Tests are added or updated if you fix a bug or add a feature.
  • X CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

…ck 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
@rails-bot rails-bot bot added the railties label Apr 28, 2024
@byroot byroot merged commit d366a99 into rails:main Apr 28, 2024
4 checks passed
@bensheldon bensheldon deleted the patch-1 branch April 29, 2024 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants