httpamazon-web-servicesamazon-ec2

HTTP requests not working on aws ec2


I am building an app in node.js and I’m using AWS EC2 to host it. However, my HTTP requests are not working.

My app is split into two repositories: app-ui and app-server. app-server contains all of my server side code/API’s. In app-ui, I am making simple POST requests such as:

$.ajax({
    type: "POST",
    url: "http://ec2-xx-xxx-xx/api/users",
    success: function(data) {
        console.log(data);
    },
    error: function(a) {
        console.log(a);
    }
});

However, I keep getting the net::ERR_CONNECTION_TIMED_OUT error.

Does anyone know what might be happening?


Solution

  • Add an inbound rule for the security group attached to your server for the specific port you're using.