I have a .NET Core Web API hosted in Azure App Service, with API Management in front of it.
I have added the IP of API Management to be allowed in inbound traffic to my App Service:
If i send a request without a subscription key to the API Management endpoint i get
{
"statusCode": 401,
"message": "Access denied due to missing subscription key. Make sure to include subscription key when making requests to an API."
}
When i add subscription key and send request through postman, it will just be infinitely loading unless i set a timeout.
I can send requests directly to the App Service endpoint url (by temporarily adding my IP to allowed IP addresses in network settings) and it works perfectly fine, and when i check logstream i can see logs that my request was successfully handled in my middleware.
But when i send requests to the API Management endpoint, there are no logs in the App Service logstream from my middleware.
When i check the logs in API Management i find this error, which doesn't help me much:
Any idea what could cause this? Maybe i've done something wrong with how i've set up App Service / API Management.
CodePudding user response:
Ugh, found the mistake. I had accidentally set the "Web service URL" in API Management settings to the API Management URL instead of the App service URL, so it was essentially trying to send requests to itself, perhaps resulting in an endless loop.