Hi,
2 routes have been declared for 1 service with method+path :
- method=POST,PATCH path=["/objects", “/objects/{id}”]
- method=DELETE path=["/objects/{id}"]
DELETE request is not routed :
Kong returns “no Route matched with those values”.
Any idea ?
Thx.
fomm
2
Hi,
I think you did not define your route correctly.
Please try below:
Create Service and Route
- Define first service
curl -X POST \
--url http://localhost:8001/services \
--header "Content-Type: application/json" \
--header "Accept: application/json, */*" \
--data '{"name":"first-service","url":"https://mockbin.org/request"}'
- Define first route. I assume ID numbers are in digits
curl -X POST \
--url http://localhost:8001/services/first-service/routes \
--header "Content-Type: application/json" \
--header "Accept: application/json, */*" \
--data '{"name":"first-route","paths":["/objects","/objects/(?<id>\\d+)"],"methods":["POST","PATCH"]}'
- Define second service (different upstream)
curl -X POST \
--url http://localhost:8001/services \
--header "Content-Type: application/json" \
--header "Accept: application/json, */*" \
--data '{"name":"second-service","url":"https://httpbin.org/anything"}'
- Define second route.
curl -X POST \
--url http://localhost:8001/services/second-service/routes \
--header "Content-Type: application/json" \
--header "Accept: application/json, */*" \
--data '{"name":"second-route","paths":["/objects/(?<id>\\d+)"],"methods":["DELETE"]}'
TEST
The DELETE
request should reach httpbin
curl -X DELETE http://localhost:8000/objects/123
The POST
request should reach mockbin
curl -X POST http://localhost:8000/objects/123