Search code examples
wso2wso2-api-manager

WSO2 Multiple Gateway deployment production/sandbox endpoints


I'm using a distributed deployment with sandbox and production gateway linked to a control plane. I'm using the sandbox and production endpoints differently for every API. With OAuth2, there is no problem because depending on which token I use, it redirects to the correct endpoint but how do I tell WSO2 which endpoint to use when it is a basic-auth or just no Auth?

I can call a different host-name for each gateway maybe and I can tell WSO2 to use the production endpoint always for production host-name and vice-versa?

It always use default production endpoint when using no OAuth2.


Solution

  • When you generate an access token for the OAuth2, it contains the key type such as sandbox or production. Based on this value it redirects to the relevant endpoint. But for Basic auth or no Auth cases, there is no such option. One thing you can do here is use a dynamic endpoint option here where you can dynamically set the backend endpoint based on your logic. This logic can be based on the request data or some other data. Please check - https://apim.docs.wso2.com/en/latest/design/api-policies/regular-gateway-policies/adding-dynamic-endpoints/