How to write rules engine for Azure Premium Verizon CDN, httpTohttps & SPA rewrite rules?

Dhanush kumar Sivaji 40 Reputation points
2023-03-03T18:07:15.4066667+00:00

I have added my react build files in a storage blob container and enabled a static website for that.

After that, I enabled Azure CDN classic ( Microsoft CDN ).

Below are the rules I have given for that.

The first Rule is to convert the HTTP to HTTPS

The second Rule is for SPA redirect.

enter image description here

It works fine. Now my client has asked me to upgrade the Azure CDN to Premium Verizon CDN.

But when I check the Rules engines, it's entirely a different UI. How I don't know how to add the rules that I added for the Classic CDN.

Here I am attaching the screenshot of the Premium Verizon CDN rules engine page.

enter image description here

it's entirely different than the classic one. I am new to Azure and CDN.

Please help me to add the rules in the Premium CDN that I added in the classic one. I tried but no luck.

Your help is much appreciated here

I am trying to add the rules that I created for the Classic CDN to Premium Verizon CDN

Azure Content Delivery Network
{count} votes

Accepted answer
  1. GitaraniSharma-MSFT 46,766 Reputation points Microsoft Employee
    2023-03-21T14:12:02.47+00:00

    Hello @Dhanush kumar Sivaji ,

    I understand you would like to know how to write rules using Azure Premium Verizon CDN rules engine for http to https redirect & SPA rewrite rules.

    Please find the steps below:

    • From the CDN profile page in your Azure portal, select Manage to open the CDN management portal.
    • Select the HTTP Large tab, then select Rules Engine V4.0.
    • Select + New to create a new draft policy.
    • Give the policy a name. Select Continue, then select + Rule.
    • Enter a name in the Name / Description textbox.

    Refer: https://docs.edgecast.com/cdn/Content/HRE/HRE.htm?tocpath=Content%20Delivery%7CRequest%7CCustom%20Request%20Handling%20via%20Rules%20Engine%7C_____0

    Details on how to define source in Verizon rules engine:

    Refer: https://docs.edgecast.com/cdn/Content/HTTP_and_HTTPS_Data_Delivery/Accessing_Your_Content.htm

    The syntax for source in Verizon rules engine is defined as below: Content Access Point/Regular Expression

    The content access point, which appears directly after the CDN hostname, allows Verizon CDN to identify the source for the requested content.

    The base format for the content access point is a forward slash followed by a two-digit number that precedes the account number. This two-digit number is called the origin identifier.

    enter image description here

    AN in the above screenshot represents your customer account number which can be found in the upper right corner of the Verizon CDN management portal.

    From your screenshot, 1A905D seems to be your account number, so your content access point will be /801A905D/yourorigin.

    enter image description here

    • Now add the below rules:

    1) To redirect http to https:

    enter image description here

    Here, you can either add the source as /801A905D/cdnendpointname/originpath/ for a specific path or /801A905D/cdnendpointname/ for the whole endpoint.

    2) For SPA redirect:

    Points to consider here:

    The URL Rewrite feature defines the request URLs that will be rewritten. As a result, additional match conditions are not required.

    URL rewrite can only be applied on if General Always match.

    URL rewrite feature includes matching criteria that must be met before it can be applied to a request. In order to prevent setting up conflicting match criteria, this feature is incompatible with the match conditions mentioned in the below doc.

    Refer: https://docs.edgecast.com/cdn/Content/HRE/F/URL-Rewrite.htm#Compatibility

    So, the URL rewrite in Verizon rules engine cannot be added with a specific match condition. But if you are just trying to rewrite a path or the origin, you can do so by the below rule:

    enter image description here

    Here, your originpath will be rewritten to a newpath and will include text captured from the source after that.

    For example: The URL rewrite rule is - source: /801A905D/cdnendpointname/marketing/(.*) and destination: /801A905D/cdnendpointname/resources/$1

    When a request comes with https://example.com/marketing/index.html

    It will rewrite to: https://example.com/resources/index.html

    • Select Lock Draft as Policy. Once you lock the draft into a policy, you won't be able to add or update any rules within that policy.
    • Select Deploy Request.

    If this CDN profile is new with no previous rules or production traffic, you can select the environment as Production in the drop-down menu. Enter a description of the environment and then select Create Deploy Request.

    Refer: https://docs.edgecast.com/cdn/Content/HRE/HRE.htm?tocpath=Content%20Delivery%7CRequest%7CCustom%20Request%20Handling%20via%20Rules%20Engine%7C_____0#GettingStarted

    NOTE: Once the policy has been deployed, it will take about 30 mins for propagation. If you want to add or update more rules, you'll need to duplicate the current rule and deploy the new policy.

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


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Sanja Stojkova 6 Reputation points
    2023-08-16T11:41:39.1133333+00:00

    Hi @GitaraniSharma-MSFT
    Can I generate these rules as Infrastructure as Code (IaaC) using CDKTF? Or are they required to be exclusively specified within the RuleEngine?

    0 comments No comments