Custom domains. You’ve already got your branding, you don’t need ours getting in the way.

I’ve just put the finishing moves on the custom domain handler for Hosted. I’ll be honest I’ve not come up with this all by myself, I actually followed the outline written by OhDear.app

Essentially, follow that guide. On your backend you’ll then need an endpoint to handle the ask config option. Caddy will call your endpoint with a GET request and an url parameter domain - e.g. https://dash.hosted.fm/auth-domain?domain=feed.wyltr.com

From there it’s up to you whether to auth the SSL certificate. Return a 200 if you’re saying yes, return a 403 or something like that otherwise. In our case we check the Domains table, this keeps a record of all custom domains that should be pointing at us.

When a request comes in, we make sure we’ve got the domain in this table. If yes, return response('Authorized', 200). If not, abort(403, 'Unauthorized.'). Simple enough ‘eh?

From there Caddy will snap up an SSL certificate from LetsEncrypt and begin serving HTTPS for your custom domain.

As Caddy is just performing the SSL handling we can deploy simple Caddy servers anywhere in the world - and will do when we’re ready for production - so that your users get the benefit of hitting a server closer to them.