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:
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.
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.
The source section UI of the rule has been changed it seems, could you please tell me whether I have added it here correctly?
mfe-cdn-premium - is the name of the CDN
container/latest - is the directory where the index.html resides
https://mfe-cdn-premium.azureedge.net/ - this is the URL of the CDN, when you open this it shows web content not found
@Dhanush kumar Sivaji
Thank you for your response. I understand the UI has changed and it is difficult to follow the documentation now. I will create a doc feedback item for this request internally.
from the screenshot you shared above.
Not sure, but just confirming if you have added the correct value. The value for "xxxxxxx" should be
Account Numberis the
account hex idwhich you can find in the right-hand corner of the supplemental portal. For example, if your account hex id is
A2B0Athe xxxxxxx should be
The origin path should be just container name containing the index.html file.
I think the rest of the rule is set-up correctly. If you are still getting web content not found error then can you please validate if the HTTPS request is working fine? Thank you!