Azure CDN rules engine to add header parameters for authenticated requested by the site

0

I am using Azure CDN to publish my web application from Blob storage. I've successfully set up a custom domain. I've added a rewrite rule in the CDN to redirect my backend API services "https://my-app-**.azurewebsites.net/api/" with header Authorization.

The CDN request here and

curl --location --request GET 'https://****.azureedge.net/api/Payments?PageNumber=1&PageSize=2' \
--header 'Authorization: ****************' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json'

goes to "actual backend API"

curl --location --request GET 'https://my-app-**.azurewebsites.net/api/Payments?PageNumber=1&PageSize=2' \
--header 'Authorization: ****' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json'

But the response is always Unauthorized with the CDN. Header params are always rejected. Any reason or comment.

1

0
  • While using CDN security token authentication with a rewrite rule, activate Azure CDN Security token by using the rules engine for the CDN endpoint and path where users can access the file.

  • The parameter options for a security token authentication are different than the parameter options for a SAS token.

  • We have to write the regular expression in rewrite rules for the URL to accept the headers and the required parameters for passing in the API URL.

  • After creating rewrite rules, New rules take up to 4 hours to propagate.

To know the rules engine when doing the rewrite URLs in CDN, please refer this Microsoft documentation and this SO Thread

2021-11-24 10:20:20

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................