Is there any way to stop catering further requests to server from HAProxy when a bankend server sends a 500?
When a server receives a signal like SIGINT, it will start serving "500 Server Internal Error" . SO when HAProxy detects 500 response from server, will it be able to stop further requests to the server?
There is a macro "on-error" which is enabled by default in server section. Trying that did not yield any result. For example:
server nucleus_server1 127.0.0.1:12341 check on-error mark-down
.the macro on-mark-down is not working along with this.
Any ideas?
If you want HAProxy marks server as DOWN based on return code sends by this server add 'observe layer7' option to server definition. For your example, it could look like:
server nucleus_server1 127.0.0.1:12341 check on-error mark-down observe layer7 error-limit 1
It means that if nucleus_server1 returns 500 to any client request it will be removed from the pool. By 'error-limit' you can configure how many 500's have to be returned to mark this server as 'DOWN'.
Server will be marked as 'UP' again if internal HAProxy check success (by default 2 times).
Take a look on: check, fall, raise, error-limit, observe options in HAProxy documentation for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With