URL Rewrite for adding SAS token. Edgio premium rules engine

Sirish Bajpai 5 Reputation points
2023-09-09T09:13:34.6833333+00:00

I am trying to setup a CDN endpoint to serve static image files from a blob container. To restrict public access, the container account allows selected vnets and IPs and access is via SAS tokens. The CDN therefore has to rewrite request URL to blob origin to inject SAS as query param

I believe this would be a very common scenario and a detailed documentation would exist someplace. Alas all the literature I found is very confusing. For e.g, its's very hard to figure out what the source' and destination in rewrite rule should be?

My set for fetching a file {image-file-name} is as below

CDN external endpoint is: https://mycdnep.azureedge.net/*{images-file-name}*

Blob endpoint is: https://myblobaccount.blob.core.windows.net/imagecontainer/images/*{image-file-name}*

Origin on CDN is set to:

Type: Storage

Host: myblobaccount.blob.core.windows.net

Origin Path: None

Please let me know what the correct source and destination should be on Edgio premium rules engine URL-Rewrite feature to inject a SAS token.

Verizon supplement management portal documentation is also pretty scarce and tailored for its own CDN customers rather than Azure customers.

Any help greatly appericiated.

Azure Content Delivery Network
{count} vote

1 answer

Sort by: Most helpful
  1. GitaraniSharma-MSFT 49,006 Reputation points Microsoft Employee
    2023-09-12T14:25:55.4666667+00:00

    Hello @Sirish Bajpai ,

    I understand that you are trying to setup a CDN endpoint to serve static image files from a blob container and to restrict public access, the container account allows selected Vnets and IPs, and access is via SAS tokens, and you would like to know how to rewrite request URL to blob origin to inject SAS as query param using Edgio premium rules engine.

    I just found that this is already available in the below doc which shows how to use CDN security token authentication with a rewrite rule using Azure CDN Premium from Edgio profile:

    https://video2.skills-academy.com/en-us/azure/cdn/cdn-sas-storage-support#option-2-using-cdn-security-token-authentication-with-a-rewrite-rule

    The URL rewrite uses the below parameters:

    Source:(container1/.*) --> Replace container1 with your container name from your Storage endpoint URL.

    NOTE: For the source, you can also use just (.*).

    Destination: $1&sv=2017-07-29&ss=b&srt=c&sp=r&se=2027-12-19T17:35:58Z&st=2017-12-19T09:35:58Z&spr=https&sig=kquaXsAuCLXomN7R00b8CYM13UpDbAHcsRfGOW3Du1M%3D

    You just need to replace everything after $1 with your own SAS token from the Azure Storage Account.

    Refer: https://video2.skills-academy.com/en-us/rest/api/storageservices/create-account-sas#account-sas-uri-example

    The above URL is constructed using the parameters shown in the below doc:

    https://video2.skills-academy.com/en-us/rest/api/storageservices/create-account-sas#construct-an-account-sas-uri

    But looks like the screenshot on the Using CDN security token authentication with a rewrite rule doc is from an older UI.

    So, I'm sharing the new UI look screenshot below:

    User's image

    If the above screenshot is not clear, try to access this file: EdgioCDNSASRewriteRule.png

    If you need a basic understanding of how to draft/write URL rewrite rules for Azure Premium Verizon CDN, please refer the below thread where I've explained it in more detail:

    https://stackoverflow.com/questions/75595941/how-to-write-rules-engine-for-azure-premium-verizon-cdn-httptohttps-spa-rewri

    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.