How can I set up a Load Balancer for my Expressjs based application?

I’ve set up a load balancer that is picking up my droplets by tag, however, they are always showing as a status of “down”.

I am pointing the load balancer directly to my nodejs APIs, without Nginx or anything sitting in front. I also have an endpoint set up called “/health” which simply returns a status of 200, and the load balancer set to use that endpoint.

Below is the configuration for my Expressjs server.

app.set('trust proxy', true);

app.get('/health', (req, res) => res.sendStatus(200));
app.use('/api', routes);

app.listen(PORT, () => {
        chalk.yellow(`Listening on *:${PORT}`)

My load balancer configuration is as follows

Forwarding rules 
HTTP on port 80  HTTP on port 3000
HTTPS on port 443  HTTP on port 3000

Least Connections

Health checks

Sticky sessions 

Redirect HTTP to HTTPS

Proxy Protocol

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer