Skip to content

Allow SSL without hosts when a custom certificate is provided - #1925

Open
nskha101 wants to merge 1 commit into
basecamp:mainfrom
ChatFeatured:hostless-custom-ssl
Open

Allow SSL without hosts when a custom certificate is provided#1925
nskha101 wants to merge 1 commit into
basecamp:mainfrom
ChatFeatured:hostless-custom-ssl

Conversation

@nskha101

@nskha101 nskha101 commented Aug 4, 2026

Copy link
Copy Markdown

The host requirement on proxy.ssl exists because automatic (ACME) TLS cannot issue a certificate without knowing the hostname. When certificate_pem and private_key_pem are supplied no issuance happens — kamal-proxy serves the given certificate for any SNI and routes through its empty-host catch-all service.

Multi-tenant apps that receive arbitrary customer Host headers at the origin (for example behind Cloudflare for SaaS, where customer domains CNAME to a fallback origin) need exactly this shape: TLS termination with a custom certificate and no host list, so unknown hosts still reach the app.

kamal-proxy already supports it — kamal-proxy deploy --tls --tls-certificate-path ... --tls-private-key-path ... with no --host flag deploys a catch-all TLS service (verified in production use). Only the config validator refused the combination, with an error about automatic SSL that does not apply to custom certificates.

The change scopes the host requirement to the automatic-TLS case: ssl: true still requires a host; ssl: { certificate_pem: ..., private_key_pem: ... } no longer does.

The host requirement exists because automatic (ACME) TLS cannot issue a
certificate without knowing the hostname. With certificate_pem and
private_key_pem supplied, no issuance happens — kamal-proxy serves the
given certificate for any SNI and routes via its empty-host catch-all
service, which multi-tenant apps receiving arbitrary customer Host
headers (e.g. behind Cloudflare for SaaS) depend on.

kamal-proxy already supports this: `deploy --tls --tls-certificate-path
... --tls-private-key-path ...` with no --host flag deploys a catch-all
TLS service. Only the validator refused the configuration.
Copilot AI balanced review requested due to automatic review settings August 4, 2026 16:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Allows hostless SSL proxy configurations when custom certificates are supplied, while retaining the host requirement for automatic TLS.

Changes:

  • Detects complete custom certificate configurations.
  • Exempts them from automatic TLS host validation.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if config["host"].blank? && config["hosts"].blank? && config["ssl"]
custom_ssl_certificate = config["ssl"].is_a?(Hash) &&
config["ssl"]["certificate_pem"].present? && config["ssl"]["private_key_pem"].present?
if config["host"].blank? && config["hosts"].blank? && config["ssl"] && !custom_ssl_certificate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants