Skip to content

Commit

Permalink
Configure hosts for application
Browse files Browse the repository at this point in the history
Note: the healthcheck endpoints are requested by IP, not domain, so we
need to specifically exclude them from the protection.
  • Loading branch information
brucebolt committed Oct 8, 2024
1 parent 66870b4 commit 1bae05f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@
config.active_record.dump_schema_after_migration = false

# Enable DNS rebinding protection and other `Host` header attacks.
# config.hosts = [
# "example.com", # Allow requests from example.com
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
# ]
config.hosts = [
/local-links-manager\..*gov.uk?/,
]

# Skip DNS rebinding protection for the default health check endpoint.
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
config.host_authorization = { exclude: ->(request) { request.path.match?("^\/healthcheck") } }
end

0 comments on commit 1bae05f

Please sign in to comment.