Problem Description
I have a service running inside docker (docker running on my windows 10 machine)and is accessible through Traefik acting as a reverse proxy. "Host(pixel.docker.localhost)" is accessible over browser and postman. However, If I try to ping this from command line ping https://pixel.docker.localhost or try to access this pixel.docker.localhost over a get request using HttpClient in a .net console app running on my windows machine , I get error that "no such host exists".
I modified the host file on my windows machine and added an entry as below:
192.168.x.x pixel.docker.localhost
After adding this entry, I am able to ping https://pixel.docker.localhost as well as access this using HttpClient in a .net console app running on my windows machine.
Question
Why are browser and postman able to resolve pixel.docker.localhost without entry in host file but ping command from cmd and HttpClient fails to find this host ?
Seems that it is not Traefik related question but rather how to Windows DNS name resolutions work.
Do we have a Windows expert in our community that could explain that topic?
Thanks for clarifying. Do you know if Traefik can be configured for localhost scenario differently that would not require me to modify hosts file on windows? It should be fine for me to access Traefik over https://localhost:port instead of pixel.docker.localhost. However, I am not sure how would I configure that.
I will also try to find if dotnet httpclient has a mechanism to resolve *.localhost to the loop back address.