Jason Kim's Blog

Enable HTTPS for a Rails app with Kamal to Azure
2024-12-03

Refer to previous two posts to deploy a Rails app to Azure.

This post is made for:

  • Ruby: 3.3.5
  • Rails: 8.0.0
  • Kamal: 2.3.0

1. Load Balancer Setup

  1. Sign into Azure
  2. Search for Load Balancers and select it.
  3. Select the load balancer for the VM running the Rails app.
  4. Select Settings > Inbound NAT rules link in the left sidebar.
  5. Click +Add
  6. Create a new NAT inbound rule like below

2. Rails App

Setup the Rails like like the following.

2.1 config/environments/production.rb

config.force_ssl = true

2.2 config/deploy.yml

...
proxy:
  ssl: true
  host: yourdomain.com
...

2.3 Deploy and Check

  1. Run kamal deploy
  2. Check yourdomain.com