The application shows a 500/503 response code when hosted on the Avi load balancer.
There could be multiple configuration points that can lead to a 500 or 503 response from the Avi Load Balancer.
A few of them are listed below with concerning logs suggesting the cause:
Validate if the server is sending a 503 or 500 response.
Check the same from VS Logs.
Significance log: "Request ended abnormally:response code 5xx"
Following is a sample snippet:
For such behavior, check the backend application server to identify the cause of such response.
SSL handshake failure with the server.
Check the VS logs on UI with significance log: "Connection closed abnormally: connection dropped due to server side SSL handshake failure"
A sample screenshot is below :
To resolve the above, consider checking the two points below:
Unable to connect to the backend server on the configured port.
The above can be identified from VS logs with significance log : "Connection setup failed: server conn setup timed out".
A sample screenshot is below:
For pools with no health monitor configured. the backend server will not be marked down when unreachable on the desired port. As the Avi service engine is not receiving any response from the server, Avi LB vip will respond with a 503 response code to the client.
To resolve the above behavior, consider checking the below points:
The configured datascript on the virtual service is not correct
This can be identified from VS logs with significance: "Request ended abnormally: Datascript failed to execute"
Below is a sample snippet:
To resolve the above, please review the datascript attached to the virtual service and correct it as required.
Reference guide for datascript functions supported by Avi load Balancer: Datascript functions
Configuration on Avi virtiual service or pool should be corrected as required.