I’ve successfully set up Gravitee 4.2 inside my Docker containers following the official instructions in the docs. Everything seems to be working fine when I use an external API (not on localhost), such as https://catfact.ninja/fact as a gateway.
However, I’m encountering an issue when I try to point the endpoints to either another Docker container running or to an app on my local machine. The API Gateway consistently returns a “502 Bad Gateway” error.
I’ve attempted to use Bash inside the API-gateway container to curl to the container or app running on my local machine, but does not work, I can ping the machine, but when I try to use this command: curl -X GET 127.0.0.1:3000 the server does not respond. I’ve tried various endpoint configurations, including:
127.0.0.1:3000
host.docker.internal:3000
localhost:3000
{container_ip}:3000
But none of these configurations seem to resolve the issue.
I’m wondering if there’s something specific I need to do to make this work. Any guidance would be greatly appreciated.
I’m attempting to use Gravitee as gateway for container running on port 3000 (it’s a backend server that exposing an API that return JSON). I aim to utilize the gateway on port 8082 with the following URL format: http://localhost:8082/message-nifi. The adjacent URL is intended to act as gateway to the API of the container running on port 3000. Here is my export JSON API: https://drive.google.com/file/d/1o-RMhgJTqc-0eDWNNsy9bz5YO80txShn/view?usp=drive_link
As you are running a docker-compose, you need to use the service name as the host.
Let's say your backend running on port 3000 is named my_service
, you will need to use http://my_service:3000
as a backend.