Front Door Standard/Premium with rule set

Azure Public Test Date Azure Public Test Result

Azure US Gov Last Test Date Azure US Gov Last Test Result

Best Practice Check Cred Scan Check

Bicep Version

Deploy To Azure Visualize Visualize

This template deploys a Front Door Standard/Premium with a rule set.

Sample overview and deployed resources

This sample template creates a Front Door profile with a rule set. To keep the sample simple, Front Door is configured to direct traffic to a static website configured as an origin, but this could be any origin supported by Front Door.

The rule set is configured to identify any incoming requests that go to a path beginning with /secure/, and to redirect these requests to https://microsoft.com using an HTTP 307 temporary redirect. You can easily replace this rule with your own by reviewing the documentation about rule set match conditions and actions.

The following resources are deployed as part of the solution:

Front Door Standard/Premium

  • Front Door profile, endpoint, origin group, origin, and route to direct traffic to the static website.
    • Note that you can use either the standard or premium Front Door SKU for this sample. By default, the standard SKU is used.
  • Front Door rule set with a single rule and the following configuration:
    • Match condition:
      • If: request path begins with secure/ (transform to lowercase)
    • Action:
      • Then: URL redirect (HTTP 307) to https://microsoft.com

Deployment steps

You can click the "deploy to Azure" button at the beginning of this document or follow the instructions for command line deployment using the scripts in the root of this repo.

Usage

Connect

Once you have deployed the Azure Resource Manager template, wait a few minutes before you attempt to access your Front Door endpoint to allow time for Front Door to propagate the settings throughout its network.

You can then access the Front Door endpoint. The hostname is emitted as an output from the deployment - the output is named frontDoorEndpointHostName. If you access the base hostname you should see a page saying Welcome. If you see a different error page, wait a few minutes and try again.

To test the rule set, try appending /secure/123 to the URL. You should get redirected to the Microsoft website.

Tags: Microsoft.Cdn/profiles, Microsoft.Cdn/profiles/afdEndpoints, Microsoft.Cdn/profiles/originGroups, Microsoft.Cdn/profiles/originGroups/origins, Microsoft.Cdn/profiles/ruleSets, Microsoft.Cdn/profiles/ruleSets/rules, Microsoft.Cdn/profiles/afdEndpoints/routes