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.
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.
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.
- Now add the below rules:
1) To redirect http to https:
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:
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.
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.