caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
55.48k stars 3.91k forks source link

caddytls: set SNI server name in context #6324

Closed willnorris closed 1 month ago

willnorris commented 1 month ago

Set the requested server name in a context value for certmagic.Manager implementations to use. Pass ctx to tscert.GetCertificateWithContext.

This relies on https://github.com/tailscale/tscert/pull/9 to be merged first, which adds the new tscert.GetCertificateWithContext method. This will enable https://github.com/tailscale/caddy-tailscale/pull/53, which enables the use of auto_https with tsnet servers running inside of caddy.

This PR only attaches the server name inside the Tailscale certmagic.Manager. I tried to find the right place to attach it for all managers, but couldn't seem to find it. I'd love some pointers for where to put this.

/cc @mholt