I didn’t use curl. I added that configuration to Caddyfile and ran caddy reload. I then visited https://mydomain.com with Chrome and it worked. However https://subd.mydomain.com threw ERR_SSL_PROTOCOL_ERROR error.
I understand, but I’m asking you to so we can see more diagnostic information. Browsers do all sorts of weird things, and it’s why, in our help template which you ignored, we ask people to demonstrate the problem with curl. It avoids all the browser-induced side-effects and gives us more information to be helpful to you, rather than wasting both sides’ time. (curl -v to be specific)
The missing help template also asks for Caddy logs, and for a good reason: with curl in verbose mode and Caddy logs, we can often piece together the problem right away.
So, I can only guess. I assume it’s because you are trying to serve a wildcard domain and Caddy can’t procure a certificate. But I am not sure what your whole config looks like now. If it’s just what you posted, then it won’t have a certificate unless you control the domain mydomain.com. See, our template also asks not to redact domain names because we need that information to help you.
Just to be clear, that is an advanced topic and you’ll need to know the basics of Caddy first, like how to write a Caddyfile and how automatic HTTPS works, etc. The official documentation we’ve linked to goes into detail about all that. Especially for on-demand TLS, which is a functionality that only Caddy offers. In fact, it’s a feature so advanced that large companies have invested tens or hundreds of thousands of dollars into other, more complex software solutions to do this very thing: yet it’s free and simple with Caddy.
If you’re just serving subdomains for your domain name, though, don’t use on-demand TLS. Use a single wildcard certificate instead.
Yes, it would be nice if all our work was done for us. But that’s not how this works, because everyone’s config is different. 2 days isn’t much time for a beginner – I’d suggest keep working at it, reading and experimenting, and you will eventually become expert at how everything works. There’s a lot at play, and while Caddy makes it simple, you have to know how to use your tools and what’s going on with the rest of the computer and the network, etc.
Anyway, I’m sorry if you’re getting frustrated. If you can provide more information (logs, curl output, full and unredacted config, etc.) we can help you better.
@matt - my apologies. You’re right - I’m looking for very advanced configuration. I should have followed the template. I’ll create another thread with all the required information and I hope to find some help.
Thank you for all the wonderful work you’ve been doing with Caddy!