basecamp / thruster

MIT License
672 stars 16 forks source link

Support multiple TLS domains #26

Closed hasghari closed 10 hours ago

hasghari commented 2 months ago

If I am reading the documentation correctly, it seems like thruster only supports a single TLS domain. Is it a big lift to support multiple TLS domains in the same Rails app using thruster like api.example.com and www.example.com?

3v0k4 commented 2 months ago

You are right, currently only one domain is supported because we pass TLS_DOMAIN to autocert.HostWhitelist.

If @kevinmcconnell is interested in supporting multiple domains, I'd be happy to submit a PR.

kevinmcconnell commented 2 months ago

I like the idea of supporting multiple domains 👍 That's a great idea.

@3v0k4 I'd love to see a PR for it! Are you thinking we'd use a comma-separated list, like TLS_DOMAIN=api.example.com,www.example.com? Or something else?

3v0k4 commented 2 months ago

Yes, the comma-separated list is the first thing that came to mind.

Should we rename the env to TLS_DOMAINS? I think it would self-document better.

kevinmcconnell commented 2 months ago

Hmm, good question...! I'd be tempted to leave it as-is, because I think the common case will be for a single domain, and it reads nicer for that case. Maybe we could try that way first, and mention the list form of its value in the documentation, and see how that feels?

hasghari commented 2 months ago

Thanks for the feedback and your support for adding in this feature. I've created #28 as a first stab at this.

victorlcampos commented 1 month ago

Why not wildcard SSL? TLS_DOMAIN=*.example.com

airblade commented 2 weeks ago

This would allow serving both example.com and www.example.com (with a redirect in the Rails app from one to the other).