Merge pull request #3421 from overleaf/bg-fix-health-checks-for-web-closed

fix load balancer health checks for web-closed

GitOrigin-RevId: f46ecec4539740bc4f0324944b2b4d6273025211
This commit is contained in:
Brian Gough 2020-11-30 10:10:28 +00:00 committed by Copybot
parent ce853aa17e
commit cde6160973
2 changed files with 20 additions and 1 deletions

View file

@ -139,7 +139,12 @@ module.exports = HttpErrorHandler = {
},
maintenance(req, res) {
// load balancer health checks require a success response for /
if (req.url === '/') {
res.status(200)
} else {
res.status(503)
}
let message = `${Settings.appName} is currently down for maintenance.`
if (Settings.statusPageUrl) {
message += ` Please check https://${Settings.statusPageUrl} for updates.`

View file

@ -49,5 +49,19 @@ describe('siteIsOpen', function() {
done()
})
})
it('should return a 200 on / for load balancer health checks', function(done) {
request.get('/', (error, response, body) => {
response.statusCode.should.equal(200)
done()
})
})
it('should return a 200 on /status for readiness checks', function(done) {
request.get('/status', (error, response, body) => {
response.statusCode.should.equal(200)
done()
})
})
})
})