End of Sale Notice:

F5 NGINX is announcing the End of Sale (EoS) for NGINX Management Suite API Connectivity Manager Module, effective January 1, 2024.

F5 maintains generous lifecycle policies that allow customers to continue support and receive product updates. Existing API Connectivity Manager Module customers can continue to use the product past the EoS date. License renewals are not available after September 30, 2024.

See our End of Sale announcement for more details.

Error Response Format

Learn how to use the F5 NGINX Management Suite API Connectivity Manager to configure the Error Response Format policy that customizes HTTP error codes and messages.

Overview

In API Connectivity Manager, you can apply global policies to API Gateways and Developer Portals to ensure your organization’s security requirements are enforced.

When you add policies at the environment level, they will apply to all proxies hosted within that environment.

See the Learn about Policies topic for an overview of the different policy types and available policies.


About the Policy

This policy specifies how the API gateway will intercept HTTP errors from the backend(s) and respond to the client with a standard or customized error response in JSON format. The client will receive the Custom Status and Error Message in JSON format, instead of the standard HTTP error coming from the backend. The Error Response Format policy is applied by default to any new environment.

Intended Audience

This guide is meant for Infrastructure Administrators.

Infrastructure Administrators ensure uniform governance across an organization’s infrastructure by setting policies at the infrastructure level, enabling teams to build APIs without interruption while adhering to the organization’s standards.


Workflow for Applying Policy

To apply the policy or make changes to it, follow these steps:


Policy Settings

Note:
Either errorMessage or errorMessageBody must be provided for each error code.
Field Type Possible Values Description Required Default Value
errorCode int In range 400-599 The error code that needs to be used by the NGINX data-plane to return to the user. Yes N/A
errorMessage string Max length 2048 The customized error message that needs to be used by the NGINX data-plane to convey error information. No N/A
errorMessageBody object Example: {"errMsg":"My Message"} The customized JSON errors that needs to be used by the NGINX data-plane to convey error information to the user. No N/A

Applying the Policy

You can apply this policy using the web interface or the REST API.


To create an Error Response Format policy using the REST API, send an HTTP POST request to the environment endpoint.

Method Endpoint
POST /infrastructure/workspaces/{workspace}/environments/{environment}
JSON request
{
  "policies": {
     "error-response-format": [
        {
           "systemMetadata": {
              "appliedOn": "inbound",
              "context": "global"
           },
           "action": {
              "400": {
                 "errorCode": "13",
                 "errorMessage": "Bad Request"
              }
           }
        }
     ]
  }
}

This JSON example defines an Error Response policy.

To add an Error Response Format policy using the web interface:

  1. In a web browser, go to the FQDN for your F5 NGINX Management Suite host and log in. Then, from the Launchpad menu, select API Connectivity Manager.
  2. On the left menu, select Infrastructure.
  3. Choose the workspace that includes the environment for the cluster you want to add the policy to.
  4. Select the environment.
  5. In the list of clusters, locate the cluster you want to add the policy to. On the Actions menu (represented by an ellipsis, ...), select Edit Advanced Config.
  6. On the left menu, select Global Policies.
  7. From the list of policies, locate the Error Response Format policy, then select Add Policy from the Actions menu (represented by an ellipsis, ...).
  8. Configure the associated Error Code, Error Message and Error Message Body for each error code.
  9. Additional entries can be created by selecting “Add Error Code” at the bottom of the table.
  10. Select Add to apply the policy to the cluster.
  11. Select Save and Submit to deploy the configuration.