Custom domains and SSL in Rails development - Avo

30-May-2025 23
There's nothing wrong with the traditional Rails approach of starting the server using rails server or bin/dev and navigating to localhost:3000. But there are some cases where having a custom domain name, even for local development, can be useful: Working with subdomains: route constraints can help us work with subdomains, but browser session cookies are domain-scoped. This means that api.localhost:3001 and localhost:3000 are considered different domains, which means that cookies won't be shared between them in case we need it. Development and production parity: having parity between development and production is generally desirable. Of course, SSL is just one part of the equation, but it can help us discover issues before our customers do. Things like CORS or secure cookies are better tested with custom and secure local domains.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle