An Azure service that provides a hybrid, multi-cloud management platform for APIs.
Hi Enrico, glad you got this sorted! Just adding a note for anyone who lands here with the same symptoms.
The trace message “Origin header was missing or empty and the request was classified as not cross-domain. CORS policy was not applied” looks like an error but isn’t one. It’s just APIM saying the request had no Origin header, so there was nothing for the CORS policy to do. That’s expected when you use the Test console in the portal, or call the API from Postman or curl. CORS only comes into play for cross-origin requests from a browser.
So the CORS policy was a red herring here. The 400 was coming from somewhere else, and as you found, the culprit was the firewall configuration. APIM couldn’t properly reach the backend where the Plumber API is hosted.
If you hit a similar 400 or timeout, check these first:
- Is your backend allowing inbound traffic from the APIM instance’s IP addresses?
- Does the backend URL in APIM point to the right host and port?
- Does calling the backend directly from outside work, and does the Trace tab show the request actually reaching it?
Once you start calling the API from a browser-based app, the CORS policy will matter, so it’s good that it’s already in place.
Thanks for coming back and sharing the fix!