lucaslorentz / caddy-docker-proxy

Caddy as a reverse proxy for Docker
MIT License
3.02k stars 173 forks source link

basic_auth label is still being written to caddyfile as basicauth which spams logs #633

Closed brando56894 closed 1 month ago

brando56894 commented 5 months ago

Caddy recently updated the name of basicauth to _basicauth and while the former still works, it spams the logfile with tens or hundreds of messages about it. It appears that whatever magic is used to convert Docker labels to Caddy config files still interprets _basicauth as basicauth which results in a ton of log spamming as mentioned before.

Here's a section of my compose file with the updated directive name in the label

  dozzle:
    container_name: dozzle
    image: amir20/dozzle:latest
    restart: always
    environment:
      TZ: America/New_York
      DOZZLE_ENABLE_ACTIONS: true
    labels:
      caddy: dozzle.mydomain.com
      caddy.reverse_proxy: "{{upstreams 8080}}"
      caddy.basic_auth: "*"
      caddy.basic_auth.bran: '$2a$14$OzxUNUtrb9vvl9AcaBaO2.hG1QF/d6ZzFguTW70KOxwpf/QmqLJUS'
      caddy.tls.dns: 'cloudflare apikey
      caddy.tls.resolvers: '1.1.1.1'
    networks:
      - web
      - internal
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - "8080:8080"

And the resulting chunk from Caddyfile.autosave

dozzle.mydomain.com {
        basicauth * {
                bran $2a$14.hG1QF/d6ZzFguTW70KOxwpf/QmqLJUS
        }
        reverse_proxy 172.18.0.2:8080
        tls {
                dns cloudflare apikey
                resolvers 1.1.1.1
        }
}

And the resulting log spamming

2024/06/19 18:00:16.177 WARN    config.adapter.caddyfile        the 'basicauth' directive is deprecated, please use 'basic_auth' instead!
2024/06/19 18:00:16.177 WARN    config.adapter.caddyfile        the 'basicauth' directive is deprecated, please use 'basic_auth' instead!
francislavoie commented 5 months ago

Make sure all your Docker services are rebooted/recreated. Do docker compose down then docker compose up -d to make sure their labels are all refreshed.

brando56894 commented 4 months ago

I just had to redo everything for other reasons so everything is fresh and I'm still getting that warning.

malemburg commented 1 month ago

Tested with 29-alpine and things work fine, so I guess you just need to upgrade to a later version.