Hello,
I'm using Kong on Docker with some other services.
Kong exposes port 8001, 8002.
API 1 service exposes 8003 port.
API 2 service exposes 8004 port.
API 3 service exposes 8005 port.
And I want to add each above API to Kong same as the instruction in Getting Started. But I couldn't found any way to do it.
Is there any solution for my situation?
Thank you in advance.
Like:
curl -d "request_path=/api1&upstream_url=http://127.0.0.1:8003" http://127.0.0.1:8001/apis/
curl -d "request_path=/api2&upstream_url=http://127.0.0.1:8004" http://127.0.0.1:8001/apis/
curl -d "request_path=/api3&upstream_url=http://127.0.0.1:8005" http://127.0.0.1:8001/apis/
?
@thefosk
Thanks for your suggestion. I can add these API to Kong but when I send request to http://127.0.0.1:8000/api1/, I got this error message:
curl http://127.0.0.1:8000/api1/
An invalid response was received from the upstream server
Maybe you need to set strip_request_path=true when adding the API:
curl -d "request_path=/api1&strip_request_path=true&upstream_url=http://127.0.0.1:8003" http://127.0.0.1:8001/apis/
curl -d "request_path=/api2&strip_request_path=true&upstream_url=http://127.0.0.1:8004" http://127.0.0.1:8001/apis/
curl -d "request_path=/api3&strip_request_path=true&upstream_url=http://127.0.0.1:8005" http://127.0.0.1:8001/apis/
Is there any resolution to this problem?
I am receiving the same error message.
well, the resolution was stripping the request path.
Hi,
Sorry to bring this up, I recently have the same problem, and realize there it has been discussed in other issues as well.
If the kong docker image cannot resolve internally http://api1/path, and you register the API to kong like that. Kong will respond:
curl http://127.0.0.1:8000/api1/
An invalid response was received from the upstream server.
A solution to that will be add it to the /etc/host of the kong docker
That is of course, if the strip_request did not solve it.
Most helpful comment
Hi,
Sorry to bring this up, I recently have the same problem, and realize there it has been discussed in other issues as well.
If the kong docker image cannot resolve internally http://api1/path, and you register the API to kong like that. Kong will respond:
curl http://127.0.0.1:8000/api1/
An invalid response was received from the upstream server.
A solution to that will be add it to the /etc/host of the kong docker
That is of course, if the strip_request did not solve it.