Is there any option to change haproxy error response code to json format. Please help.
Thanks for the update, I already done this.
errorfile 503 /var/www/http/503.json errorfile 504 /var/www/http/504.json
But this case these json messges are printing on browser not as a valid json format.
“longMessages”: [“No server is available to service the request. Please try again later.”],
“shortMessage”: “Gateway Error”,
Did you read the documentation about errorfile? You need proper HTTP headers with CR-LF lineendings, not just your json payload.