How to serve different Azure resources on different routes on a single Front Door instance?

Najam ul Saqib 340 Reputation points
2025-01-08T16:38:29.2966667+00:00

Hi,

I want that I create a single Front Door resource and attach my custom domain to it. That custom domain should direct traffic to different resources based on the route e.g. /api should redirect to API, /content will serve the storage account.

How can this be configured?

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
724 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sai Prasanna Sinde 2,785 Reputation points Microsoft Vendor
    2025-01-08T22:09:32.5166667+00:00

    Hi @Najam ul Saqib

    Welcome to the Microsoft Q&A Platform. Thank you for posting your query here.

    • You can configure a single Azure Front Door resource with a custom domain to route traffic to different backend resources based on the route using a combination of frontend endpoints, origin groups, and routing rules. For your reference: https://learn.microsoft.com/en-us/azure/frontdoor/front-door-custom-domain
    • A custom domain that you own and can manage its DNS records. You'll also need a valid SSL/TLS certificate for this domain. You can either bring your own certificate or use a free one managed by Azure Front Door. For your reference: https://learn.microsoft.com/en-us/azure/frontdoor/end-to-end-tls?pivots=front-door-standard-premium
    • Go to you Azure Front Door and search for origin group and add an origin group. Give a name to your origin group, add your origin resource, host name, header, priority, weight and health probe. For your reference: https://learn.microsoft.com/en-us/azure/frontdoor/health-probes#:~:text=To%20determine%20the,client%20requests%20to.
    • Next go to Frontend endpoints in your Azure Front Door. You can find it under settings.
    • Give a host name, if you require enable session affinity, enable and select a WAF policy to protect your application from common web vulnerabilities, it will be available only for Premium Front Door. For your reference: https://azure.microsoft.com/en-in/pricing/details/frontdoor/#:~:text=Azure%20Front%20Door%20Premium%20builds%20on%20the,is%20included%20in%20Azure%20Front%20Door%20Premium.
    • Next choose certificate type (Own certificate or Front Door managed) and click to add.
    • After adding, you will need to add a CNAME record for your custom domain to your DNS provider.
    • This CNAME record should point to your Front Door's default frontend host.
    • Next configure routing rules: Go to routing rules in your Front Door, it will be available under settings.
    • Provide name, select accepted protocols and select your custom domain. 
    • Next for your API enter /api/* and for your storage account enter /content/*, select the route type to forward for routing to your origin group.
    • Select the appropriate origin group, for the /api/* rule, choose your api-origin-group and for the /content/* rule, choose your storage-origin-group and also configure the forwarding protocol and click to add the routing rule.
    • After updating your DNS records, it might take some time for the changes to propagate globally.
    • Once DNS changes have propagated, test your custom domain.

    Kindly let us know if the above helps or you need further assistance on this issue.

    Thanks,

    Sai.

    1 person found this answer 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.