From fcd8466ddf4341c911cb09a0558918cc5009e213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 23 Sep 2022 18:20:03 +0200 Subject: [PATCH] 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 --- config/environments/development.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/environments/development.rb b/config/environments/development.rb index 42304e757..925734721 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -28,6 +28,10 @@ Rails.application.configure do config.cache_store = :null_store 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. config.action_mailer.raise_delivery_errors = false config.action_mailer.default_url_options = { host: "localhost", port: 3000 }