You are currently viewing Azure CDN – Adding Restrictions by Region

Azure CDN – Adding Restrictions by Region

Azure CDN helps in efficiently delivering the web contents to the user, by placing them nearer to the user. The contents are cached at CDN POP. But in real world, you might want to restrict access to the content by country or region. The term geo-filtering is used for this kind of restrictions.

The process to update geo-filtering in standard tier is different from the premium tier. This post covers geo-filtering only for standard tiers.

Azure CDN Standard from Microsoft profiles do not support path-based geo-filtering.

You would need to have an Azure account with an active subscription.  If you do not have it yet, you can create one for free. And then sign in to the Azure portal.

Geo-Filtering Option

Refer this post for creating the CDN profile: Azure Content Deliver Network – Create Profile. Ensure you select any Standard tier except Standard Microsoft.

Once the setup is done, you can navigate to the CDN profile. This CDN profile would have one or more endpoints. Select the endpoint for which you want to apply geo-filtering.

To access the geo-filtering feature, select your CDN endpoint within the portal, then select Geo-filtering under SETTINGS in the left-hand menu.

Rules

Once the geo-replication panel is opened, it would show a view to input rules. Every rule has :

  • Path, the relative path to the location to which users will be allowed or denied access
  • Action, Can be either Allow or Block
  • Country Codes, list of country codes where this rule is applicable

If the Action is Allow, then only the users from specified countries would be able to allow the resources from the recursive path. If the Action is set to Block, then users would not be allowed access to the resource.

The Path is a relative URL. It can be specific( e.g. /images/image.png) Or it can just map to a folder (e.g. /images/uk/).

Below snapshot shows couple of rules:

Azure Portal: Azure CDN Endpoint and Geo-Filtering in Standard Pricing Tier

The above snapshot shows two hypothetical rules, just for the sake of understanding the geo-restriction rules. The images from /pictures/india/ are allowed to be accessible from India The images from /pictures/us/ would not be accessible from USA and UK.

I hope you found this information useful. Let me know your thoughts.

Leave a Reply