Kong returning 404. Not able to map API

2,104 views
Skip to first unread message

​Suraj ​Kumar

unread,
Jun 29, 2016, 9:01:52 AM6/29/16
to Kong
I have installed the Kong successfully and mapped an API using Administration service API provided by Kong. when I am making a get call to "/apis" it is returning the response like below:
{
"upstream_url": "http://test.suraj.com:9110/"
"strip_request_path": true
"request_path": "/services_test"
"id": "595d5166-8f95-41a0-b3t7-89eba9978eac"
"created_at": 1467186265000
"preserve_host": false
"name": "services_test"
"request_host": "test.suraj.com"
}

Now I am calling my APIs like :
http://kong:8000/services_test/testapi

it is returning 404.
What I am doing wrong?
I am not able to access kong's log. can anyone tell me where kong stores log files?
Thanks for any help.


Martin Danielsson

unread,
Jul 4, 2016, 8:41:22 AM7/4/16
to Kong
Hello Suraj,

The reason why you get a 404 here is that you have supplied both 'request_host' and 'request_path'. This isn't something you should do. Skip 'request_host' when adding your API via POST, and you should be fine. Otherwise kong listens to the "Host" of the request, and if that doesn't match the request, you will not get anything back.

Kong's logs are by default stored in /usr/local/kong/logs, but by default the access.log is not written, only the error.log. You should look at the log plugins, depending on what you need to do.

Best regards,
Martin

Thibault Charbonnier

unread,
Jul 4, 2016, 2:47:47 PM7/4/16
to kong...@googlegroups.com

Additionally, I would recommend that you read the Proxy Reference to have more insight as to how Kong maps incoming requests to upstream services:

https://getkong.org/docs/latest/proxy/

--
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.
To post to this group, send email to 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/c9c947a7-eda0-460b-b751-bb0f589dd2c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

​Suraj ​Kumar

unread,
Jul 6, 2016, 3:22:50 AM7/6/16
to Thibault Charbonnier, kong...@googlegroups.com
Thanks  Martin and Thibault. Now its working for me. Proxy Reference link is helpful.
Thanks a lot.

Thanks
 Suraj

--
You received this message because you are subscribed to a topic in the Google Groups "Kong" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/konglayer/ZEooisy6uE0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to konglayer+...@googlegroups.com.

To post to this group, send email to kong...@googlegroups.com.
Visit this group at https://groups.google.com/group/konglayer.

Martin Danielsson

unread,
Jul 6, 2016, 3:28:54 AM7/6/16
to Kong, thib...@mashape.com
Btw Thibault, does mixing request_host and request_path work as you might expect it to do now? I remember I could just choose one method of distinguishing APIs.

/Martin

Thibault Charbonnier

unread,
Jul 6, 2016, 1:56:19 PM7/6/16
to kong...@googlegroups.com

No, request_path and request_host are distinctive properties and do not mix together.

Reply all
Reply to author
Forward
0 new messages