Hello everyone.
I’m having problems when trying to call the route of my HTTP GET request API. The same program works when I try to make the same communication with a VM which hosts Kong API Gateway. Then I tried to host it on AWS EC2 instance but I figured out this problem.
I opened the ports 8000 and 8001 creating inbound rules in the security group and I tried to modify the kong.conf file as well to allow communication from anyone, but I can’t solve.
Thanks for replying! Locally on my Windows host, I have two Node.js programs: server.js and db_addon.js (ideally db_addon.js has to be on another machine, it is the next step). Server.js makes calls to the Kong api gateway which is running on an AWS ec2 instance to solve the API to call db_addon’s services. But I got 504 HTTP error.
Before I tried the same communication between my windows host and a Ubuntu VM and it was working fine. Could it be mandatory an HTTPS communication?
The failing flow is this one: Server JS (local) → Kong (EC2 instance 2) → DB Service (EC2 instance 1)
This is a typical log from the access.log, but it doesn’t give me more informations:
[06/Dec/2023:11:01:24 +0000] “GET /getall HTTP/1.1” 504 102 “-” “axios/1.6.2” kong_request_id: “65d5b75bf5dfb946ec9a855e797e414c”
Could it be that Kong blocks the communication because over the internet it must be mandatory via HTTPS protocol? I was thinking this but I can’t find anything about it in the documentation
HTTPS is not a mandatory but a good practice. For testing purpose it should not matter.
Check the following,
If in your security group whether the port connection is allowed to your DB service from Kong instance. Inbound rule on DB service should have the entry.
Login to Kong instance via SSH and try curl to your DB service (curl -v http://IP/getall)
If you are using external IP for DB service in Kong upstream, try the internal IP of instance
Sorry for the misunderstanding. Now I understand what you were asking me. You certainly meant the one used by Kong as DB Service. Well that resides on the same machine where Kong is running (basic installation via script). By DB Service I meant the MySQL instance to which the db_addon service refers, which resides on a different EC2 instance (but this is not what interests us).