Basic Auth "Error during parsing"

1. Caddy version (caddy version):

latest (Docker)

2. How I run Caddy:

Docker

a. System environment:

Fedora 33 Host with Docker

b. Command:

docker-compose up -d

c. Service/unit/compose file:

version: "2"
services:
  caddy:
    image: abiosoft/caddy
    restart: always
    volumes:
      - ./Caddyfile:/etc/Caddyfile:ro
      - caddycerts:/root/.caddy
    ports:
      - 80:80
      - 443:443
    environment:
      ACME_AGREE: 'true' # agree to Let's Encrypt Subscriber Agreement
      EMAIL: 'hi'

volumes:
  caddycerts:

networks: 
  default: 
    external: 
      name: caddyproxy

d. My complete Caddyfile or JSON config:

# Caddyfile
domain1.domain.xyz {
    tls {$EMAIL}

    header / {
        # Enable HTTP Strict Transport Security (HSTS)
        Strict-Transport-Security "max-age=31536000;"
        # Enable cross-site filter (XSS) and tell browser to block detected attacks
        X-XSS-Protection "1; mode=block"
        # Disallow the site to be rendered within a frame (clickjacking protection)
        X-Frame-Options "DENY"
        # Prevent search engines from indexing (optional)
        X-Robots-Tag "none"
    }

    proxy /notifications/hub/negotiate bitwarden:80 {
        transparent
    }

    proxy /notifications/hub bitwarden:3012 {
        websocket
    }

    proxy / bitwarden:80 {
        transparent
    }
}

domain2.domain.xyz {
    tls {$EMAIL}

    # Proxy to application
    proxy / Applicationname:6595 {
        transparent
    }

    basicauth / {
        Admin JDJhJDE0JHpnWWRnRUE4M3dDU2w1ZVNZUm9iV2VlL2FvejVBNHJ2cGJDVEtZcVlxRGtDUzlwSmFEYWwu
   }
}

(both username and hashed password are placeholders)

3. The problem I’m having:

When adding basic auth to the above config file as displayed above I get the below error message.

4. Error messages and/or full log output:

Activating privacy features... 2021/01/10 01:02:26 [INFO][cache:0xc0000ac8c0] Started certificate maintenance routine
2021/01/10 01:02:26 /etc/Caddyfile:40 - Error during parsing: Wrong argument count or unexpected line ending after '/'
done.
exit status 1

5. What I already tried:

Searched the error message and “wrong arguement count basic auth” and similar to no response here and across the web. Proxy works without basicauth.

Caddy v1 is no longer supported. Please upgrade to Caddy v2.

Use the official image from Docker Hub

And read the upgrade guide:

This topic was automatically closed after 30 days. New replies are no longer allowed.