CodexBloom - Programming Q&A Platform

OCI Load Balancer Health Check scenarios with 503 Service Unavailable scenarios for Node.js Application

๐Ÿ‘€ Views: 31 ๐Ÿ’ฌ Answers: 1 ๐Ÿ“… Created: 2025-06-09
oci load-balancer node.js JavaScript

I'm sure I'm missing something obvious here, but I'm working with an scenario with my OCI Load Balancer where the health checks are returning a 503 Service Unavailable behavior for my Node.js application. My setup includes a backend set with two instances running a simple Express server that responds to health check requests. The health check is configured to hit an endpoint `/health` that returns a 200 status code if the application is running fine. Hereโ€™s the relevant code snippet from my Express server: ```javascript const express = require('express'); const app = express(); app.get('/health', (req, res) => { res.status(200).send('OK'); }); const PORT = process.env.PORT || 3000; app.listen(PORT, () => { console.log(`Server is running on port ${PORT}`); }); ``` The load balancer is set to perform health checks every 30 seconds with a timeout of 5 seconds, using the HTTP protocol. The backend set configuration specifies the health check port as 3000, which matches the port my application is listening on. Iโ€™ve also ensured that the security lists and network security groups allow traffic on port 3000. Despite this, the health checks unexpected result consistently, resulting in the backend being marked as unhealthy and no traffic being routed to my instances. I've tried increasing the health check timeout to 10 seconds, but that didnโ€™t help either. I also verified that the application can be accessed directly via the public IP, and the `/health` endpoint is reachable from my local machine using `curl http://<public-ip>:3000/health`. I'm not seeing any logs from the application that indicate itโ€™s receiving the health check requests, which makes me think the scenario might be at the network level. Could there be any other configuration settings I might be overlooking, or is there a specific way OCI requires health checks to be set up for Node.js applications? Any insights would be greatly appreciated! Any feedback is welcome!