Ruby on Rails
Configure Rails to accept requests through Hatch's reverse proxy.
Map your domain
hatch add myapp.test 3000 --https
Host authorization
Rails 6+ blocks requests from unrecognized hosts. Add your Hatch domain to the allowed list in config/environments/development.rb:
# config/environments/development.rb Rails.application.configure do config.hosts << "myapp.test" end
Binding
Bind to all interfaces:
rails server -b 0.0.0.0
Or set it in config/puma.rb: bind 'tcp://0.0.0.0:3000'
Force SSL and proxy headers
If you enable force_ssl in development (for testing), configure Rails to trust Hatch's forwarded headers:
# config/environments/development.rb
config.action_dispatch.trusted_proxies = [
IPAddr.new('127.0.0.1')
]Project config
# .hatch.yaml
domains:
- domain: myapp.test
port: 3000
https: true