Handling 404 on non existing API resources at Org Level

Hello,

I have deployed a separate proxy (basepath '/') to handle non existing API resources.

I would like to know the consequences any If I continue to use this proxy to handle 404 at Org level.

Appreciated your inputs !

Solved Solved
0 3 214
1 ACCEPTED SOLUTION

Hi @Viswa

It is recommended to implement a proxy with basepath "/" to handle invalid requests and return a proper error. Only downside can be if you have a SaaS implementation of Edge with the contract based on number of API calls, then each call to this separate proxy will also add up to your API calls counter

View solution in original post

3 REPLIES 3

Hi @Viswa

It is recommended to implement a proxy with basepath "/" to handle invalid requests and return a proper error. Only downside can be if you have a SaaS implementation of Edge with the contract based on number of API calls, then each call to this separate proxy will also add up to your API calls counter

Could you give more details about what policies should be used and how to do the same with node.js?

As for which policies should be used, that is up to you. I think the scenario we are discussing here in this question is, "how to handle requests to the / basepath". In the simple case, you might want to just return a static 404 response with a simple payload that suggests a few links. In that case you might do so with a single AssignMessage policy configured on the Response flow.

What do you mean by "how to do the same with nodejs"? Can you please elaborate? What specifically do you wish to do? You could define an API Proxy , listening at the basepath of / , and use a nodejs target in that apiproxy. The nodejs might return a static response. But that seems like an unnecessarily complication. It seems like you have some other goal in mind. If so, please elaborate!