Duplicate site adress in production

(Venkateswar) #1

caddy env file

# Caddy
# ------------------------------------------------------------------------------
DOMAIN_NAME=balajidigitals.in

caddyfile in production

{$DOMAIN_NAME} {
    redir https://balajidigitals.in
}

{$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
    gzip
}

error when I run docker-compose up

caddy_1 | 2018/04/25 23:48:21 duplicate site address: balajidigitals.in

(Matthew Fay) #2

If you’ll entertain the idea of following the variable substitution, you get…

balajidigitals.in {
  ...
}

balajidigitals.in {
  ...
}

As you can see, this indeed a duplicated site definition.

You can remove the first entry entirely - when port and scheme are unspecified, Caddy serves on both HTTP and HTTPS, and handles the upgrade redirection for you.

1 Like
(Venkateswar) #3

I tried removing

{$DOMAIN_NAME} {
    redir https://balajidigitals.in
}

getting same error, but when I remove

DOMAIN_NAME=balajidigitals.in

it will run but my domain will not be reachable.

I tried with domains whose dns is not resolvable thinking that my dns settings on digitalsocean is issue. but it’s something to do with the caddy config.

Thanks for replying on my question