Modify Default 404 response in cloud instance

Not applicable

When we hit a resource which doesnt exist in any of he proxies, Apigee returns a 404 with following body -

{ "fault": { "faultstring": "Classification failed for host paymark-dev.apigee.net", "detail": { "code": "CLASSIFICATION_FAILED" } } }

We want to customize this response for our setup in the cloud instance. i.e we do want to return a 404 but without any body.

I dont want to create another proxy to catch all, as calls to that proxy might also be billed.

Can someone please let me know if this is doable.

2 5 768
5 REPLIES 5

sgilson
Participant V

Can you create a custom fault rule? See the doc here for more info:

http://apigee.com/docs/api-services/content/fault-handling#customhandlingofhttperrorcodesfromthetarg...

Stephen

Not applicable

Great question!

The classification error is a result of your proxy BasePath not matching anything defined in your org. If you want to control this error message you will need to deploy a proxy that matches https://paymark-dev.apigee.net/ and return an appropriate error payload.

adas
Participant V

@jaskaran.rm The classification error is usually thrown by the router if the basepath doesn't match. The only way to handle this would be to deploy another proxy with a basepath of "/" so that all requests atleast match that and then you can do customized error messages in that proxy using fault handling rules. But since you do not want to deploy any additional proxies, you won't be able to implement this solution.

In our router, there's a provision to map specific error codes so that you can send custom responses to the caller, but that is only supported for 5xx responses so you won't be able to take advantage of that. So like @David Allen suggested, you can go down the path of a custom proxy with "/" basepath so that you never get a 404 Classification Error. You can then return specific responses using Assign Message or Fault Rules policies.

sarthak
Participant V

@jaskaran.rm I have a question for you :

What do you mean by this statement : "I dont want to create another proxy to catch all, as calls to that proxy might also be billed."

Because it looks like what you can or cannot do is based on the validity of that statement , so I want to make sure it is correct.

Not applicable

The criteria on your rate plan should only bill for status code 2XX responses. You would never want to charge for failed transactions. A catch all is really the only way to ensure that you have control of the error message - otherwise you will get classification fault body messages when a consumer executes an arbitrary URL.