- config
Rails.application.config.hosts << /.*/
-
env
- rails 6.0.3.2
-
works
- When set regexp to config.hosts, it evaluate as sanitized regexp (ref: method of
sanitize_regexp
).
- When set regexp to config.hosts, it evaluate as sanitized regexp (ref: method of
# sanitized regexp
host = /.*/
sanitize_regexp(host)
-> /\A(?-mix:.*)\z/
# check to allow host (via: allows?)
allowed = /\A(?-mix:.*)\z/
allowed === 'example.com'
-> true
allowed === 'xxxx.com'
-> true
- ref: GitHub rails/rails ActionDispatch::HostAuthorization
PR where the file was added: rails/rails#33145