aws ec2 with nodejs app curl error 7 failed to connect to host port 5000

Viewed 28

I deployed a nodeJS app to AWS EC2 instance. When I access public IPv4 of instance following by port number, nodeJS app work perfectly. When I use my local terminal and type curl http://3.X.X.X:5000/auth/checkauth I got response from NodeJS app. Problem is when I use terminal of my shared hosting server to type curl http://3.X.X.X:5000/auth/checkauth I got following error (image n°1) enter image description here

In the same shared hosting server, I type curl http://3.X.X.X to point to another AWS EC2 instance using Laravel app and it works.

Here is my group security rules for inbound rules in AWS EC2 instance. (image n°2) enter image description here

Please, how can I solve curl 7 error ? Thanks


Here is my NodeJS code working in AWS EC2 instance.

const express = require("express");
const bodyParser = require("body-parser");
const fs = require("fs");
const axios = require("axios");
const shelljs = require("shelljs");
const config = require("./config.json");

const app = express();    
const port = process.env.PORT || config.port;
app.use(bodyParser.json({ limit: "50mb" }));
app.use(express.json());

app.use(express.urlencoded({ extended: true }));

const chatRoute = require("./components/chatting");

app.use(function (req, res, next) {
  console.log(req.method + " : " + req.path);
  next();
});
app.use("/chat", chatRoute);

app.listen(port, '0.0.0.0', () => {
  console.log("Server Running Live on Port 5000");
});
0 Answers
Related