# "An invalid response was received from the upstream server" when trying to ping

**URL:** <https://discuss.konghq.com/t/an-invalid-response-was-received-from-the-upstream-server-when-trying-to-ping/2647>\
**Category:** Questions\
**Created:** [January 18, 2019, 4:09pm UTC](https://discuss.konghq.com/t/an-invalid-response-was-received-from-the-upstream-server-when-trying-to-ping/2647 "2019-01-18T16:09:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hokicsuka](https://avatars.discourse-cdn.com/v4/letter/h/c4cdca/32.png) [@hokicsuka](https://discuss.konghq.com/u/hokicsuka)\
**Post date:** [January 18, 2019, 4:09pm UTC](https://discuss.konghq.com/t/an-invalid-response-was-received-from-the-upstream-server-when-trying-to-ping/2647/1 "2019-01-18T16:09:45Z")

</div>

Hello,

I’m trying to import new services in Kong, but I keep getting the same error message (502: Bad Gateway). The service is the EdgeX core\_data ping and it works without KONG. It should respond with ‘pong’. The response message says that “An invalid response was received from the upstream server”.

HTTP request:

curl -i -X GET --url [http://localhost:8000/](http://localhost:8000/) --header ‘Host: [coredata.com](http://coredata.com)’

This is the service :

{  
“host”: “127.0.0.1”,  
“created\_at”: 1547827284,  
“connect\_timeout”: 60000,  
“id”: “9fbe2306-6eed-4f33-be22-8e51900e043c”,  
“protocol”: “http”,  
“name”: “core\_data\_go”,  
“read\_timeout”: 60000,  
“port”: 48080,  
“path”: “/api/v1/ping”,  
“updated\_at”: 1547827284,  
“retries”: 5,  
“write\_timeout”: 60000  
}

This is the route to the service:

{  
“next”: null,  
“data”: [  
{  
“created\_at”: 1547827379,  
“methods”: null,  
“id”: “ac2a985f-f329-49ed-a280-37b36311efd2”,  
“service”: {  
“id”: “9fbe2306-6eed-4f33-be22-8e51900e043c”  
},  
“name”: null,  
“hosts”: [  
“[coredata.com](http://coredata.com)”  
],  
“updated\_at”: 1547827379,  
“preserve\_host”: false,  
“regex\_priority”: 0,  
“paths”: null,  
“sources”: null,  
“destinations”: null,  
“snis”: null,  
“protocols”: [  
“http”,  
“https”  
],  
“strip\_path”: true  
}  
]  
}  
I think my problem is quite basic and should have an easy solution, but somehow I can’t figure it out. Some help would be really appreciated!

Greetings

---

<div class="post-metadata">

**Author:** ![Dephin\_Gokul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/dephin_gokul/32/1116_2.png) [@Dephin\_Gokul](https://discuss.konghq.com/u/Dephin_Gokul)\
**Post date:** [June 17, 2019, 11:18am UTC](https://discuss.konghq.com/t/an-invalid-response-was-received-from-the-upstream-server-when-trying-to-ping/2647/2 "2019-06-17T11:18:05Z")

</div>

Hi,

I faced similar problem as yours on my 1st try with KONG. From your sample response, it seems that you have registered your service with 127.0.0.1. If you have installed KONG as docker, this 127.0.0.1 will point to docker’s 127.0.0.1, not your host machine’s 127.0.0.1. Instead, you have to register your service with your local host machine’s IP address. After this change, it worked for me. Sample response of create service below:

```
    {
    "host": "10.190.30.222",
    "created_at": 1560770064,
    "connect_timeout": 60000,
    "id": "5ece1209-b68d-4f7d-8737-00068daa25f9",
    "protocol": "http",
    "name": "get-all-orderssss",
    "read_timeout": 60000,
    "port": 9080,
    "path": "/api/orders/",
    "updated_at": 1560770064,
    "retries": 5,
    "write_timeout": 60000,
    "tags": null
 }

```

Your ping API will work same way with IP address.  
[http://localhost/api/v1/ping](http://localhost/api/v1/ping) == [http://xx.xx.xx.xxx/api/v1/ping](http://xx.xx.xx.xxx/api/v1/ping)

---

<div class="post-metadata">

**Author:** ![inallib](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/inallib/32/3736_2.png) [@inallib](https://discuss.konghq.com/u/inallib)\
**Post date:** [December 6, 2022, 5:32pm UTC](https://discuss.konghq.com/t/an-invalid-response-was-received-from-the-upstream-server-when-trying-to-ping/2647/3 "2022-12-06T17:32:49Z")

</div>

you just need to add host=docker.for.mac.localhost in your kong.yaml thats it

---

<div class="post-metadata">

**Author:** ![bombxdev](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/bombxdev/32/3823_2.png) [@bombxdev](https://discuss.konghq.com/u/bombxdev)\
**Post date:** [February 6, 2023, 5:02am UTC](https://discuss.konghq.com/t/an-invalid-response-was-received-from-the-upstream-server-when-trying-to-ping/2647/4 "2023-02-06T05:02:28Z")

</div>

> [@inallib](#):
>
> host=docker.for.mac.localhost

can I see your `docker-compose.yml` file? If I have 1 kong do reverse\_proxy to multiple domain names.
