How to debug the kong API on community edition


#1

Hi,
I am trying to create a pass-through API proxy using Kong community edition. I have used below commands to create/add the service, route and basic auth plugin

  1. Service -
    curl -i -X POST http://localhost:8001/services/
    -d ‘name=foo-service’
    -d ‘url=http://xxxxxxxxxxxx.com:8080’

  2. Route -

curl -i -X POST http://localhost:8001/routes/
-d ‘hosts[]=xxxxxxxxxxxx.com
-d ‘paths[]=/api/CustomerManagement/V1/customer’
-d ‘strip_path=false’
-d ‘service.id=dadae525-602d-46e2-9d17-580830d44b8f’
-d ‘methods[]=GET’
-d ‘methods[]=POST’
-d ‘methods[]=PATCH’
-d ‘methods[]=DELETE’

  1. Basic Auth plugin -

curl -X POST http://localhost:8001/routes/4f181b2a-ea70-4d7f-8c67-669f60c20bbf/plugins
–data “name=basic-auth”
–data “config.hide_credentials=true”

  1. Consumer -

curl -i -X POST
–url http://localhost:8001/consumers/
–data “username=abcorgapp”

  1. Create credentials -

curl -X POST http://localhost:8001/consumers/abcorgapp/basic-auth
–data “username=abcorguser”
–data “password=demo2019”

  1. Call API -

curl -i -X GET
–url http://localhost:8000/api/CustomerManagement/V1/customer
–header “Host: xxxxxxxxxxx.com
–header ‘Authorization: Basic YWJjb3JndXNlcjpkZW1vMjAxOQo=’

The kong is running on docker container and the backend service that I want to hit is also on another container. I am able to hit that service using curl command from the machine where docker engine is running.

I am getting below error when I hit the API.

HTTP/1.1 404
Content-Length: 0
Connection: keep-alive
Date: Mon, 11 Feb 2019 05:27:02 GMT
X-Kong-Upstream-Latency: 44
X-Kong-Proxy-Latency: 5
Via: kong/1.0.2

This must be coming from Kong to backend connectivity because - If I call the API with incorrect path then it gives the route not matched error, If I give wrong credentials then it gives a 403 forbidden error. So connection between postman to Kong is working fine but there is something missing to configure.

Can anyone help me and let me know how to debug this issue of if I have to do more configuration to make this work?

Regards,
Santosh