# Traefik host not accessible using Ping or HttpClient from dotnet applicatoin

**URL:** <https://community.traefik.io/t/traefik-host-not-accessible-using-ping-or-httpclient-from-dotnet-applicatoin/14407>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [May 9, 2022, 6:20pm UTC](https://community.traefik.io/t/traefik-host-not-accessible-using-ping-or-httpclient-from-dotnet-applicatoin/14407 "2022-05-09T18:20:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nish26](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/nish26/32/5312_2.png) [@Nish26](https://community.traefik.io/u/Nish26)\
**Post date:** [May 9, 2022, 6:20pm UTC](https://community.traefik.io/t/traefik-host-not-accessible-using-ping-or-httpclient-from-dotnet-applicatoin/14407/1 "2022-05-09T18:20:25Z")

</div>

**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](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](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 ?

---

<div class="post-metadata">

**Author:** ![jakubhajek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/jakubhajek/32/3389_2.png) [@jakubhajek](https://community.traefik.io/u/jakubhajek)\
**Post date:** [May 10, 2022, 3:03pm UTC](https://community.traefik.io/t/traefik-host-not-accessible-using-ping-or-httpclient-from-dotnet-applicatoin/14407/2 "2022-05-10T15:03:00Z")

</div>

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?

Thank you,

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [May 10, 2022, 3:07pm UTC](https://community.traefik.io/t/traefik-host-not-accessible-using-ping-or-httpclient-from-dotnet-applicatoin/14407/3 "2022-05-10T15:07:56Z")

</div>

Its not windows either. Firefox, Chrome, Postman and I'm sure others resolve(in application) \*.localhost to the loopback address.

Linux can be configured via a nsswitch plugin to resolve them natively also.

This works in browser.

```shell
$ curl -k https://site.localhost
curl: (6) Could not resolve host: site.localhost

```

---

<div class="post-metadata">

**Author:** ![Nish26](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/nish26/32/5312_2.png) [@Nish26](https://community.traefik.io/u/Nish26)\
**Post date:** [May 11, 2022, 6:13am UTC](https://community.traefik.io/t/traefik-host-not-accessible-using-ping-or-httpclient-from-dotnet-applicatoin/14407/4 "2022-05-11T06:13:58Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [May 14, 2022, 6:14am UTC](https://community.traefik.io/t/traefik-host-not-accessible-using-ping-or-httpclient-from-dotnet-applicatoin/14407/5 "2022-05-14T06:14:56Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
