Skip to content

Commit 0646251

Browse files
CLDSRV-740: Add healthcheck internal route s3 port
1 parent ca6d580 commit 0646251

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/Config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,11 @@ class Config extends EventEmitter {
15481548
this.healthChecks.allowFrom = defaultHealthChecks.allowFrom
15491549
.concat(config.healthChecks.allowFrom);
15501550
}
1551+
/**
1552+
* CLDSRV-740: S3C with nginx s3-frontend needs the healthcheck on the
1553+
* same port as s3 to allow nginx upstream failover based on healthcheck
1554+
*/
1555+
this.healthChecks.enableInternalRoute = config.healthChecks?.enableInternalRoute || false;
15511556

15521557
if (config.certFilePaths) {
15531558
assert(typeof config.certFilePaths === 'object' &&

lib/utilities/internalHandlers.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const routeWorkflowEngineOperator =
44
require('../routes/routeWorkflowEngineOperator');
55
const { reportHandler } = require('./reportHandler');
66
const routeVeeam = require('../routes/routeVeeam').routeVeeam;
7+
const { healthcheckHandler } = require('./healthcheckHandler');
8+
const { config } = require('../Config');
79

810
const internalHandlers = {
911
backbeat: routeBackbeat,
@@ -13,6 +15,14 @@ const internalHandlers = {
1315
veeam: routeVeeam,
1416
};
1517

18+
if (config.healthChecks.enableInternalRoute) {
19+
// CLDSRV-740: S3C with the healthcheck on s3 port needs the internal route
20+
internalHandlers.healthcheck = function s3InternalHealthcheckHandler(clientIP, req, res, log, statsClient) {
21+
const deep = req.url === '/_/healthcheck/deep';
22+
return healthcheckHandler(clientIP, req, res, log, statsClient, deep);
23+
};
24+
}
25+
1626
module.exports = {
1727
internalHandlers,
1828
};

0 commit comments

Comments
 (0)