How to set a default response when a service cannot be found
search cancel

How to set a default response when a service cannot be found

book

Article ID: 9737

calendar_today

Updated On:

Products

STARTER PACK-7 CA Rapid App Security CA API Gateway

Issue/Introduction

When attempting to reach a gateway service that either does not exist or is otherwise unable to be resolved the below error is returned by default.

 

<detail>
<l7:policyResult xmlns:l7="http://www.layer7tech.com/ws/policy/fault" status="Service Not Found. The request may have been sent to an invalid URL, or intended for an unsupported operation."/>
</detail>
 


Environment

Release: API Gateway 10.x and 11.x And before.

Resolution

To customize the message returned to end users a catch all policy can be configured

1. Launch policy manager

2. Publish a Web API

    [9.1] Tasks Menu -> Service and APIs -> Publish Web API

    [9.0 and under] Tasks -> Publish Web API

3. Enter the resolution path as an asterisk (*). This will catch all calls at the root of the Gateway.

4. Click finish

5. You can now write a policy to suite your needs. Common uses are using a 'Return Template Response' assertion with any message you desire such as:

You can also use a customize error response and cause a fault to return a custom gateway error instead of a template response.

 

Attachments

1558693566745000009737_sktwi1f5rjvs16he5.png get_app