dmg  
                
               
                 
              
                  
                    March 23, 2020,  8:02pm
                   
                   
              1 
               
             
            
              Hi all,
I'm totally newbie with traefik, and I have some VM for testing it. It looks great and works very well with some basic config. Now I'm trying to get some advanced settings for secure dashboard.
First step is to enable basic authentication to limit access to dashboard, but I'm gonna crazy with examples, docs, and other stuff that isn't work for me. 
docker-compose.yml 
version: '3'
services:
  proxy:
    image: traefik:v2.1
    command:
      --api=true
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./conf:/etc/traefik
      - ./logs:/logs
      - ./ssl:/ssl
    networks:
      - proxy_default
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.dashboard.rule=Host(`domain.net`)"
      - "traefik.http.routers.dashboard.service=api@internal"
      - "traefik.http.routers.traefik.middlewares=auth"
      - traefik.http.middlewares.auth.basicauth.users=myuser:mypass"
networks:
  proxy_default:
    external: true
 
The dashboard only works if I set up insecure=true  for api, in that case can access through http://mydomain.net:8080 
How can I fix this? I tried config traefik.toml  with the same labels, but not working too.
             
            
               
               
               
            
            
           
          
            
              
                ldez  
                
               
              
                  
                    March 23, 2020,  8:40pm
                   
                   
              2 
               
             
            
              hello,
version: '3'
services:
  proxy:
    image: traefik:v2.1
    command:
      - --api
      - --providers.docker
      - --providers.docker.exposedbydefault=false
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./conf:/etc/traefik
      - ./logs:/logs
      - ./ssl:/ssl
    networks:
      - proxy_default
    labels:
      traefik.enable: true
      traefik.http.routers.dashboard.rule: Host(`domain.net`)
      traefik.http.routers.dashboard.service: api@internal
      traefik.http.routers.dashboard.middlewares: auth
      traefik.http.middlewares.auth.basicauth.users: user:$$apr1$$q8eZFHjF$$Fvmkk//V6Btlaf2i/ju5n/ # user/password
networks:
  proxy_default:
    external: true
 
or
version: '3'
services:
  proxy:
    image: traefik:v2.1
    command:
      - --api
      - --providers.docker
      - --providers.docker.exposedbydefault=false
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./conf:/etc/traefik
      - ./logs:/logs
      - ./ssl:/ssl
    networks:
      - proxy_default
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.dashboard.rule=Host(`domain.net`)"
      - "traefik.http.routers.dashboard.service=api@internal"
      - "traefik.http.routers.dashboard.middlewares=auth"
      - "traefik.http.middlewares.auth.basicauth.users=user:$$apr1$$q8eZFHjF$$Fvmkk//V6Btlaf2i/ju5n/" # user/password
networks:
  proxy_default:
    external: true
 
Recommend read:
             
            
               
               
               
            
            
           
          
            
              
                dmg  
                
               
              
                  
                    March 24, 2020,  9:37am
                   
                   
              3 
               
             
            
              Thank you so much, You did it!
Extra info: I'm using dynamic dns service and the domain doesn't recognize it by traefik, I must to set on host file to get it work.