Skip to content

Commit

Permalink
Add host_authorization setting for dev environment
Browse files Browse the repository at this point in the history
Sinatra 4.1 ships with a breaking change that [enables host allowlisting
middleware][1] in local development, which in turn breaks running Search
API through GOV.UK Docker.

This adds an explicit `permitted_hosts` setting for the middleware,
which includes the `search-api.dev.gov.uk` host used by GOV.UK Docker.

[1]: sinatra/sinatra#2053
  • Loading branch information
csutter committed Nov 20, 2024
1 parent ce63f15 commit 8aa119d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/rummager/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@

configure :development do
set :protection, false
set :host_authorization, {
permitted_hosts: [
"search-api.dev.gov.uk",
"localhost",
".localhost",
".test",
IPAddr.new("0.0.0.0/0"),
IPAddr.new("::/0"),
],
}
end

# Enable custom error handling (eg ``error Exception do;...end``)
Expand Down

0 comments on commit 8aa119d

Please sign in to comment.