Is Caddy not meant for testing environments?

caddy version==0.10.6

caddy_1     | 2018/03/23 13:08:53 [www.] failed to get certificate: acme: Error 400 - urn:acme:error:malformed - Error creating new authz :: Name does not end in a public suffix
caddy_1     | 2018/03/23 12:55:14 duplicate site address:
myimage_caddy_1 exited with code 1

I’m using docker-compose up to run my containers. I have local and production environments but only the production uses Caddy.

I’m trying to locally test my production build but Caddy is causing them to fail, citing(depending on my Caddyfile) duplicate address or failure to get certificates.

I can understand why it’s happening, as I’ve set my Caddyfile like this:

www.{$DOMAIN_NAME} {

    proxy / django:5000 {
        header_upstream Host {host}
        header_upstream X-Real-IP {remote}
        header_upstream X-Forwarded-Proto {scheme}
    log stdout
    errors stdout

I set the domain_name to that port to see if I can get it running locally.

So my question is, is Caddy not meant for testing? Does the DOMAIN_NAME have to be a legitimately set up DNS?

If I’m misunderstanding, can you point me to docs for setting up a testing environment?

Hi @lochness,

Caddy thinks, because www. is not an IP address, that it’s a fully qualified domain name and it’s eligible for Automatic HTTPS. As a result, it’s trying to get certificates from Letsencrypt.

To disable that, you want to turn tls off, strip the preceding www., or specify http:// before it so that Caddy recognizes the site as ineligible for TLS management.

Not sure why you’re getting a duplicate site address, though. It looks like each site block is unique in your Caddyfile. Can you update to the latest release and let us know if you still get duplicate site address errors?

To answer your closing questions, Caddy absolutely supports testing/development setups, and some features like the “short” Caddyfile are aimed directly at that use case.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.