mirror of https://github.com/rails/rails
Allow .test by default in development (#51087)
This ensures out-of-the-box compatibility with puma-dev
This commit is contained in:
parent
270eaa0565
commit
6260b6b0c8
|
@ -1,3 +1,7 @@
|
|||
* Add ".test" as a default allowed host in development to ensure smooth golden-path setup with puma.dev.
|
||||
|
||||
*DHH*
|
||||
|
||||
* Add `allow_browser` to set minimum browser versions for the application.
|
||||
|
||||
A browser that's blocked will by default be served the file in `public/426.html` with a HTTP status code of "426 Upgrade Required".
|
||||
|
|
|
@ -20,7 +20,7 @@ module ActionDispatch
|
|||
# info if `config.consider_all_requests_local` is set to true, otherwise the
|
||||
# body is empty.
|
||||
class HostAuthorization
|
||||
ALLOWED_HOSTS_IN_DEVELOPMENT = [".localhost", IPAddr.new("0.0.0.0/0"), IPAddr.new("::/0")]
|
||||
ALLOWED_HOSTS_IN_DEVELOPMENT = [".localhost", ".test", IPAddr.new("0.0.0.0/0"), IPAddr.new("::/0")]
|
||||
PORT_REGEX = /(?::\d+)/ # :nodoc:
|
||||
SUBDOMAIN_REGEX = /(?:[a-z0-9-]+\.)/i # :nodoc:
|
||||
IPV4_HOSTNAME = /(?<host>\d+\.\d+\.\d+\.\d+)#{PORT_REGEX}?/ # :nodoc:
|
||||
|
|
|
@ -3997,6 +3997,11 @@ module ApplicationTests
|
|||
assert_includes Rails.application.config.hosts, ".localhost"
|
||||
end
|
||||
|
||||
test "hosts include .test in development" do
|
||||
app "development"
|
||||
assert_includes Rails.application.config.hosts, ".test"
|
||||
end
|
||||
|
||||
test "hosts reads multiple values from RAILS_DEVELOPMENT_HOSTS" do
|
||||
host = "agoodhost.com"
|
||||
another_host = "bananapants.com"
|
||||
|
|
Loading…
Reference in New Issue