Hi,
Thanks a lot. I give my complete steps here:
My application server is in http:// xx.xx.xx.xx: 9099
My Kong is in http:// yy.yy.yy.yy
I am connecting to both xx.xx.xx.xx and yy.yy.yy.yy from my laptop (same network as xx.xx.xx.xx and yy.yy.yy.yy).
My base service URL is: http:// xx.xx.xx.xx: 9099/services/v4
First, I configure services in Kong (from yy.yy.yy.yy, the server where Kong is deployed):
$ curl -i -X POST --url http:// localhost:8001/services/ --data ‘name=v4’ --data ‘url=http://xx.xx.xx.xx:9099/services/v4’
HTTP/1.1 201 Created
Date: Thu, 16 Aug 2018 12:59:56 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Access-Control-Allow-Origin: *
Server: kong/0.14.0
Content-Length: 262
{“host”:“yy.yy.yy.yy”,“created_at”:1534424396,“connect_timeout”:60000,“id”:“16209f88-1e0a-4a80-bfdc-ba32d867b5ac”,“protocol”:“http”,“name”:“v4”,“read_timeout”:60000,“port”:9099,“path”:"/services/v4",“updated_at”:1534424396,“retries”:5,“write_timeout”:60000}
Then I configure the route:
$ curl -i -X POST --url http://localhost: 8001/services/v4/routes --data ‘paths[]=/’
HTTP/1.1 201 Created
Date: Thu, 16 Aug 2018 13:09:18 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Access-Control-Allow-Origin: *
Server: kong/0.14.0
Content-Length: 281
{“created_at”:1534424958,“strip_path”:true,“hosts”:null,“preserve_host”:false,“regex_priority”:0,“updated_at”:1534424958,“paths”:["/"],“service”:{“id”:“16209f88-1e0a-4a80-bfdc-ba32d867b5ac”},“methods”:null,“protocols”:[“http”,“https”],“id”:“720e3927-06ed-4180-80fd-48fd807e4f22”}
Now I try to access my service via Kong from my laptop,
$ curl -i -X GET --url http://yy.yy. yy.yy:8000/services/
HTTP/1.1 404 Not Found
Content-Length: 0
Connection: keep-alive
Allow: DELETE,POST,GET,OPTIONS,HEAD
Date: Thu, 16 Aug 2018 13:12:04 GMT
Server: Jetty(8.1.7.v20120910)
X-Kong-Upstream-Latency: 3
X-Kong-Proxy-Latency: 0
Via: kong/0.14.0
Of course, I tried different paths such as
$ curl -i -X POST --url http://localhost: 8001/services/v4/routes --data ‘paths[]=/services’
$ curl -i -X POST --url http://localhost: 8001/services/v4/routes --data ‘paths=/services’
and different options for curl commands such as,
$ curl -i -X GET --url http:// yy.yy.yy.yy: 8000/services/v4
$ curl -i -X GET --url http:// yy.yy.yy.yy: 8000/services/v4/ContentsByName?name=test
If something I did is wrong, it should be in the step where I created the route, without Host, but with paths option set, from what I understood from the documentation you shared and your comments. (Because that is where I changed, the step where I create the service is just the same, as when I have to use the header to pass the full path to the service).
Could you please verify what went wrong?
Thank you.
Regards,
Pradeeban.