express-httpchk
Middleware to provide status endpoint for haproxy.
Example
Add status endpoint in express.
On shutdown start sending 404, then wait for haproxy to report DOWN before closing.
var express = ;var httpchk = ; var app = ; { return status: 'OK' ;} var statusMiddleware = ; app var server = app; process;
An appropriate haproxy config. Notice the backend options.
global
daemon
defaults
mode http
frontend fe
bind *:80
default_backend be
backend be
option httpchk GET /status
http-check disable-on-404
http-check send-state
server server1 127.0.0.1:3000 check