KONG: An invalid response was received from the upstream server

5,466 views
Skip to first unread message

Vaibhav Nampurkar

unread,
Dec 7, 2017, 3:45:21 AM12/7/17
to Kong
Hi,

I have a web API running on localhost:11850 with course as a controller and get method that returns list of courses.

I have created any API in KONG as follows: 

{
    "total": 1,
    "data": [
        {
            "created_at": 1512636112781,
            "strip_uri": true,
            "id": "f5a06244-1cd6-4933-8ff6-42dc32d70792",
            "name": "GetCourse",
            "upstream_url": "http://localhost:11850/api/course/",
            "http_if_terminated": false,
            "https_only": false,
            "retries": 5,
            "upstream_send_timeout": 60000,
            "upstream_connect_timeout": 60000,
            "upstream_read_timeout": 60000,
            "methods": [
                "GET"
            ],
            "preserve_host": false
        }
    ]
}

Now I want to invoke this function using KONG API and hence I run the below command but I get an error stating "An invalid response was received from the upstream server". 


$ curl -i -X GET   --url http://localhost:8000/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    58    0    58    0     0     58      0 --:--:-- --:--:-- --:--:--  3625HTTP/1.1 502 Bad Gateway
Date: Thu, 07 Dec 2017 08:40:27 GMT
Content-Type: text/plain; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: kong/0.11.2

An invalid response was received from the upstream server

What am I missing ?

Thibault Charbonnier

unread,
Dec 8, 2017, 1:51:34 AM12/8/17
to kong...@googlegroups.com
Hi,

We cannot help you much debugging this without more information. A good
starting point for such errors is to investigate the logs
(<prefix>/logs/error.log). If it doesn't help, I would double check the
behavior of the upstream server when connecting to it via HTTP/1.1 (like
Kong does). Finally, inspecting the traffic between Kong and your
upstream (with tracers such as tcpdump) might give you some very good
insights.

By the way, I found at least 4 GitHub issues in the repository with
users encountering the same problem:

https://github.com/Kong/kong/issues/1601
https://github.com/Kong/kong/issues/2360
https://github.com/Kong/kong/issues/2005
https://github.com/Kong/kong/issues/1181

This is also a very common misconfiguration error encountered by
everyday users of vanilla NGINX. I believe you already have plenty of
available literature online to help you debug this :)

Oh, and also: we recently deprecated the usage of this mailing list, and
launched our forum, Kong Nation, at:

https://discuss.konghq.com/

We believe you will get better support there over time and hope for it
to grow into a searchable knowledge base for the community :)

Best,
Thibault
> --
> You received this message because you are subscribed to the Google
> Groups "Kong" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to konglayer+...@googlegroups.com
> <mailto:konglayer+...@googlegroups.com>.
> To post to this group, send email to kong...@googlegroups.com
> <mailto:kong...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/konglayer.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/konglayer/98995f9f-c3da-4cf1-99b2-70a71cfb98d2%40googlegroups.com
> <https://groups.google.com/d/msgid/konglayer/98995f9f-c3da-4cf1-99b2-70a71cfb98d2%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages