slight improvements in Rack::Protection::HostAuthorization docs#2097
Open
davetron5000 wants to merge 1 commit intosinatra:mainfrom
Open
slight improvements in Rack::Protection::HostAuthorization docs#2097davetron5000 wants to merge 1 commit intosinatra:mainfrom
Rack::Protection::HostAuthorization docs#2097davetron5000 wants to merge 1 commit intosinatra:mainfrom
Conversation
davetron5000
commented
Apr 26, 2025
| # Blocks HTTP requests with an unrecognized hostname in any of the following | ||
| # HTTP headers: Host, X-Forwarded-Host, Forwarded | ||
| # HTTP headers: Host, X-Forwarded-Host, Forwarded, based on | ||
| # {<tt>Request#forwarded_authority</tt>}[https://rubydoc.info/github/rack/rack/Rack/Request/Helpers#forwarded_authority-instance_method] and |
Author
There was a problem hiding this comment.
Since the ultimate user of this is likely someone working at the Rack or Sinatra level, I figured it would be helpful to include these specifics about how the hosts are determined beyond just the headers that are used.
davetron5000
commented
Apr 26, 2025
| # If you want to permit a specific hostname, you can pass in as the `:permitted_hosts` option: | ||
| # == Options | ||
| # | ||
| # [<tt>:permitted_hosts</tt>] an Array of hosts to allow. Elements can be as follows: |
Author
There was a problem hiding this comment.
Although this accepts a single value, the docs were getting complicated trying to explain that you can have an array or a value, etc. So I kept it as just an array in the docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Rack::Protection::HostAuthorization's options and behaviors could be better documented.Solution