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.
Refer this post for creating the CDN profile: Azure Content Deliver Network – Create Profile. Ensure you select any Standard tier except
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.
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.
Below snapshot shows couple of rules:
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.