BasicAuth not working, curl works with or without authentication

Here is my docker-compose.yml file

services:
  traefik:
    image: traefik:v3.7.1
    container_name: traefik
    networks:
      - proxy
    command:
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
      - "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.letsencrypt.acme.email=${LETSENCRYPT_EMAIL}"
      - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    restart: unless-stopped

  netdata:
    image: netdata/netdata:stable
    container_name: netdata
    pid: host
    networks:
      - proxy
    restart: unless-stopped
    cap_add:
      - SYS_PTRACE
      - SYS_ADMIN
    security_opt:
      - apparmor:unconfined
    volumes:
      - ./netdataconfig/netdata:/etc/netdata
      - netdatalib:/var/lib/netdata
      - netdatacache:/var/cache/netdata
      - /:/host/root:ro,rslave
      - /etc/passwd:/host/etc/passwd:ro
      - /etc/group:/host/etc/group:ro
      - /etc/localtime:/etc/localtime:ro
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /etc/os-release:/host/etc/os-release:ro
      - /var/log:/host/var/log:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.netdata.rule=Host(`${DOMAIN}`)"
      - "traefik.http.routers.netdata.entrypoints=websecure"
      - "traefik.http.routers.netdata.tls.certresolver=letsencrypt"
      - "traefik.http.services.netdata.loadbalancer.server.port=19999"
      - "traefik.http.middlewares.netdata-auth.basicauth.users=${TRAEFIKADMIN}"
      - "traefik.http.routers.netdata.middlewares=netdata-auth"

volumes:
  letsencrypt:
  netdatalib:
  netdatacache:

networks:
  proxy:

Here is my .env file

DOMAIN=netdata.example.com
LETSENCRYPT_EMAIIL=admin.example.com
TRAEFIKADMIN='user:$2y$05$gQIjpyN8.FEvBdHCxxQ6.e3K5zlLOhGGSnOfqMm9MpMKEal96niQu'

Using curl -u user:password https://netdata.example.com or curl https://netdata.example.com makes no difference and generates the correct output each time.

I can also access the dashboard without any password prompt. What am I missing?

For reference I used the command htpasswd -nbB user password to generate the credentials.

Use 3 backticks before and after code/config in posts to make it more readable and preserve spacing, which is important in yaml.

I have added the backticks as requested.

For some reason, it started working on its own. Marking this as solved.