Azure APIM with Cloudflare integration

Thaw Zin Myo 0 Reputation points
2025-06-30T16:57:45.0266667+00:00

My current development environment includes:

  • Cloudflare
  • Azure API Management (APIM) for API routing
  • DigitalOcean Kubernetes Cluster (DOKS) with services exposed via NGINX Ingress Controller

I have configured DNS A records in Cloudflare (e.g., stock-dev.example.com pointing to the ingress load balancer IP), which allows public access to services in the DigitalOcean Kubernetes Cluster(DOKS). While this setup works for development, I rightly noted that it’s not ideal for production. Now, when I call stock-dev.example.com/health, it responses 200.

Our developers have configured APIM to route requests to backend services (e.g., https://stock-dev.example.com, https://user-dev.example.com) via Cloudflare. This flow — APIM → Cloudflare → Backend Services — is currently functioning as expected. For example, in the Postman, I type APIM endpoint with the necessary headers and test it. It was success. This is just confirmation for current work flow.

However, I am now looking to reverse the flow to:

Cloudflare → APIM → Backend Services

To achieve this, I am seeking guidance on how to configure Cloudflare to route traffic to APIM (e.g., apis-dev.example.com → APIM endpoint), and what changes may be needed within APIM to support this architecture.

  1. I will call the https://apis-dev.example.com/dev/v1/member-service
  2. It should redirect to our backend service but now, I got the "HTTP Error 404. The requested resource is not found."
  3. I already configured APIM Endpoint in the Cloudflare DNS Record as CNAME( apis-dev.example.com >>> APIM Endpoint) but I got the error in the step 2.

So, what did I miss configure? Any correction! I did not find in the Google. Some are suggest to use Virtal Network (External) and then in the NSG, Azure APIM allow Cloudflare's IPs. I am not sure it is related the current issue. Thanks

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,453 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. hossein jalilian 11,055 Reputation points Volunteer Moderator
    2025-06-30T17:02:43.4266667+00:00

    Thanks for posting your question in the Microsoft Q&A forum

    To properly route traffic through Cloudflare → Azure API Management → Backend Services, make sure your custom ___domain is configured inside APIM. This includes adding it under Custom domains and uploading a valid SSL certificate. Without this, APIM will reject requests with a 404 or 503 error due to host header mismatch.

    Additionally, verify your DNS setup in Cloudflare: use a CNAME pointing to the APIM gateway and enable proxy if needed. Ensure your API path is correctly mapped in APIM and that your NSG/firewall rules allow traffic from Cloudflare. Once these steps are complete, test the full flow using your custom ___domain URL.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.