Skip to content

on_demand_tls should be a local option, not global #6722

Open
@ledlamp

Description

@ledlamp

Suppose you reverse proxy to an app that makes its own subdomains, so you use on-demand TLS and make caddy ask the app for valid hostnames. The caddyfile would look like this:

{
	on_demand_tls {
		ask http://localhost:9123/ask
	}
}

*.my.app, my.app {
	tls {
		on_demand
	}
        reverse_proxy http://localhost:9123
}

But suppose you want to run another app like this? Now there is a problem. Caddy can only be configured to ask one server, and it will ask it for all sites using on-demand. This is no good, if each app knows only what hostnames it serves.

This is how it should work instead:

*.my.app, my.app {
	tls {
		on_demand ask http://localhost:9123/ask
	}
        reverse_proxy http://localhost:9123
}

*.another.app, another.app {
	tls {
		on_demand ask http://localhost:10000/ask
	}
        reverse_proxy http://localhost:10000
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions