under-pressure
under-pressure copied to clipboard
Exclude paths/routes from 503 errors
Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
In some cases you do not want to trigger the "Service Unavailable" 503 error, a very good example would be the Swagger documentation page.
Meaning there should be an option for some kind of whitelist.
Motivation
Some pages or routes shouldn't be blocked, for example I would like to keep showing the Swagger Docs page, even if the healthCheck
fails for instance.
Example
Just an proto-type idea for such an interface by introducing an option like routeWhitelist
:
fastify.register(require('@fastify/under-pressure'), {
maxEventLoopDelay: 1000,
routeWhitelist: ['/docs'],
})
An alternative solution is to provide a config option to the route config settings for under-pressure. Just like you can set a log level per route, you should be able to "ignore" the route from under-pressure plugin.