It sounds like you may be facing an issue with the URL path of your API when proxied through Azure API Management (APIM). To debug this issue, you can follow these steps:
- Verify that the policy is correctly applied: To do this, you can check the trace logs in APIM. If the policy is not applied, it will show up in the trace logs.
- Check the request and response in APIM: You can use the "Try-It" feature in APIM to test the API and see the request and response details. This will give you a clearer picture of what's happening at the APIM layer.
- Check the routing of the request: Make sure that the API in APIM is correctly routing to the correct endpoint. You can also check the APIM product configuration to see if it's correctly configured to route the requests to the correct backend.
- Validate the endpoint URL: Ensure that the endpoint URL in APIM is correct and matches the URL that the API is expecting. You can update the endpoint URL if necessary, to include the "/api" path if it's missing.
By following these steps, you should be able to identify the root cause of the 404 error and resolve it.