basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
10.6k stars 408 forks source link

Server behind Cloudflare proxy gives SSL handshake failed #1015

Closed robertritz closed 3 days ago

robertritz commented 3 days ago

I just upgraded a server to Kamal 2.0. I reimaged the VPS and the below is my config:

# Name of your application. Used to uniquely configure containers.
service: robertritz

# Name of the container image.
image: robertritz/robertritz-website

# Deploy to these servers.
servers:
  - ip goes here

registry:
  username: robertritz
  password:
    - KAMAL_REGISTRY_PASSWORD

builder:
  arch: amd64

proxy:
  app_port: 3000
  host: robertritz.com
  ssl: true

Everything is deployed correctly and when I set Cloudflare to DNS only (bypassing their proxy) everything works great. When I add Cloudflare proxy I get an SSL Handshake Failed error.

robertritz commented 3 days ago

Ah I figured out the issue. I needed to set forward-headers to true. It's working now! Here my the config file for posterity.

# Name of your application. Used to uniquely configure containers.
service: robertritz

# Name of the container image.
image: robertritz/robertritz-website

# Deploy to these servers.
servers:
  - ip address goes here

registry:
  username: robertritz
  password:
    - KAMAL_REGISTRY_PASSWORD

builder:
  arch: amd64

proxy:
  app_port: 3000
  host: robertritz.com
  ssl: true
  forward_headers: true