Allow using the lvh.me URL in development

Rails 6.0 introduced a `hosts` option which, in the development
environment, defaults to all IP addresses and the `localhost` domain.

However, we can't work with subdomains using `localhost`. For that
purpose, the `lvh.me` domain was created [1].

So we're allowing this domain and its subdomains so we can use them
while working with multitenancy in the development environment.

[1] http://railscasts.com/episodes/123-subdomains-revised
This commit is contained in:
Javi Martín
2022-09-23 18:20:03 +02:00
parent 9057264373
commit fcd8466ddf

View File

@@ -28,6 +28,10 @@ Rails.application.configure do
config.cache_store = :null_store config.cache_store = :null_store
end end
# Allow accessing the application through a domain so subdomains can be used
config.hosts << "lvh.me"
config.hosts << /.*\.lvh\.me/
# Don't care if the mailer can't send. # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = { host: "localhost", port: 3000 } config.action_mailer.default_url_options = { host: "localhost", port: 3000 }