CodexBloom - Programming Q&A Platform

How to implement guide with oci load balancer health check scenarios for web application on compute instance

👀 Views: 21 💬 Answers: 1 📅 Created: 2025-06-05
oracle-cloud load-balancer node.js health-check JavaScript

I'm currently working with an scenario where the health checks for my OCI Load Balancer are consistently failing for my web application hosted on a compute instance. I'm using a Node.js application running on port 3000 and configured the health check to target the endpoint `/health`. The behavior I receive in the OCI console is `HTTP 5xx` for the health check requests, but when I access the `/health` endpoint directly via a browser or using `curl`, I get a valid response with `HTTP 200 OK`. Here’s the relevant snippet from my load balancer configuration: ```json { "healthCheck": { "protocol": "HTTP", "port": 3000, "urlPath": "/health", "intervalInMillis": 30000, "timeoutInMillis": 5000, "responseBody": "", "healthyThreshold": 2, "unhealthyThreshold": 2 } } ``` I also checked the security list and ensured that port 3000 is open for the Load Balancer subnet. My Node.js server is set up as follows: ```javascript const express = require('express'); const app = express(); app.get('/health', (req, res) => { res.status(200).send('Service is healthy'); }); app.listen(3000, () => { console.log('Server running on port 3000'); }); ``` I've verified that the load balancer's backend set is correctly pointing to the compute instance's private IP. Also, I've made sure that the instance's firewall and security settings aren’t blocking the health check traffic. I’ve even tried increasing the timeout values for the health check but that didn’t help either. Any insights into what might be going wrong or additional debugging steps I could take would be greatly appreciated!