Traefik doesn't resolve domain in WSL

Hi everyone,

i have an issue with traefik when i want to use my domain inside WSL..

Some details about my environment :

my host system is windows (11)
i have WSL2 with ubuntu (20.04) inside
and docker is installed in ubuntu

$ docker version

Client: Docker Engine - Community
 Version:           26.1.3

Here an example of traefik configuration :

        image: traefik:latest
        restart: no
            - "80:80"
            - "443:443"
            - /var/run/docker.sock:/var/run/docker.sock
            - ${PROJECT_PATH}/traefik/traefik.yml:/etc/traefik/traefik.yml
            - ${PROJECT_PATH}/traefik/services.yml:/etc/traefik/services.yml
            - ${PROJECT_PATH}/traefik/certs/:/etc/certs/
            - "traefik.enable=true"
            - "traefik.http.routers.dashboard.rule=Host(``)"
            - "traefik.http.routers.dashboard.entrypoints=http,https"
            - "traefik.http.routers.dashboard.service=api@internal"

on windows, if i try to access to with any browser all is ok !
on ubuntu(wsl), if i try:

$ curl

curl: (6) Could not resolve host:

Globally, all domains defined with traefik is not available under WSL.
however i confirm that ports are open and listen

docker-pr 253684 root 4u IPv4 1671203 0t0 TCP *:443 (LISTEN)
docker-pr 253690 root 4u IPv6 1671210 0t0 TCP *:443 (LISTEN)
docker-pr 253709 root 4u IPv4 1672237 0t0 TCP *:80 (LISTEN)
docker-pr 253726 root 4u IPv6 1668894 0t0 TCP *:80 (LISTEN)

thanks !

Where did you define the domain to resolve to the IP?

Some browser will resolve any domain with localhost automatically to, but I don't think curl will do that.

Hi @bluepuma77 ,

thanks for you answer ! Good point to see !

on windows, my hosts file is fully commented, so probably the domain resolution come from traefik directly no !? for me, traefik listen port 80, recognize the domain and say : "ok it's for me i know the domain in your request and i can return a response...":

# For example:
#          # source server
#              # x client host

# localhost name resolution is handled within DNS itself.
#       localhost
#	::1             localhost

on WSL:

$ cat /etc/hosts

# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateHosts = false       localhost       MY_SUPER_ID

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters