Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow .test by default in development #51087

Merged
merged 3 commits into from Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions actionpack/CHANGELOG.md
@@ -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".
Expand Down
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions railties/test/application/configuration_test.rb
Expand Up @@ -3997,6 +3997,11 @@ class Post < ActiveRecord::Base
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"
Expand Down