diff --git a/config/environments/production.rb b/config/environments/production.rb index 009d5e9fa..76a35f7cf 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -101,4 +101,12 @@ logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end + + # Enable DNS rebinding protection and other `Host` header attacks. + config.hosts = [ + /publisher\..*\.gov.uk/, + ] + + # Skip DNS rebinding protection for the default health check endpoint. + config.host_authorization = { exclude: ->(request) { request.path.match?("^\/healthcheck") } } end