AWS Application Load Balancer Throwing 502
I am currently learning about AWS and I have a single EC2 instance running with a nodejs server on port 3000, an
Application load balancer with SSL setup that listen on port
443 (http & https). When I make requests to the http route it returns back the successful health check message. But when I try to access my api via the https method, I get a
502 Error. I googled around and read some articles and they pointed out that the nodejs server
headersTimeout should be higher than the timeout option of the ALB. I tried that and it didn't work. I also tried to set the
16384, I also tried to check the access logs for the load balancer on my S3 bucket and the logs just showed that I am getting a 502 error and nothing more. What could be the issue? Because I have tried all solutions that presented but they don't seem to work.
The first thing to check is that your server is responding to requests. Try connecting to port 3000 on the server, either from the server itself (eg
curl localhost:3000) or from outside the server (which will require the Security Group to permit access to port 3000).
Once you have confirm that the server is responding, configure Security Groups as:
- A Security Group on the Application Load Balancer (
ALB-SG) that permits Inbound access on ports 80 and 443
- A Security Group on the Amazon EC2 instance (
App-SG) that permits inbound access on port 3000 from
App-SG should specifically refer to
ALB-SG in its Inbound rules.
Then, configure the Load Balancer to have a Target Group that points at port 3000 on the app server and provide it a URL for the Health Check (that could simply be
Then, connect to the Application Load Balancer and see whether you can access your app.
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error