REST API clients are often written with the expectation that the API produces a custom error format. Some clients might fail unexpectedly if they encounter an error response that uses an unexpected format.
When a REST API is proxied by PingAuthorize Server, errors that the REST API returns are forwarded to the client as is, unless a policy dictates a modification of the response. In the following scenarios, PingAuthorize Server returns a gateway-generated error:
- When the policy evaluation results in a
denyresponse. This scenario typically results in a 403 error.
- When an internal error occurs in the gateway, or when the gateway cannot contact the REST API service. This scenario typically results in a 500, 502, or 504 error.
By default, these responses use a simple error format, as in the following example.
"errorMessage": "Access Denied",
The following table describes this default error format.
|HTTP status code
Because some REST API clients expect a specific error response format, PingAuthorize Server provides a facility for responding with custom errors, called error templates. An error template is written in Velocity Template Language and defines the manner in which a Gateway API Endpoint produces error responses.
Error templates feature the following context parameters.
|Original Request URI
|Query parameters as JSON object
|Request headers as JSON object
|Request correlation ID
For more information, see Error templates.