Securing Azure CDN assets with token authentication

Securing Azure CDN assets with token authentication

Overview

Token authentication is a mechanism that allows you to prevent the Azure Content Delivery Network (CDN) from serving assets to unauthorized clients. Token authentication is typically done to prevent hotlinking of content, in which a different website, such as a message board, uses your assets without permission. Hotlinking can have an impact on your content delivery costs. By enabling token authentication on CDN, requests are authenticated by CDN edge server before the CDN delivers the content.

How it works

Token authentication verifies that requests are generated by a trusted site by requiring requests to contain a token value that holds encoded information about the requester. Content is served to a requester only if the encoded information meets the requirements; otherwise, requests are denied. You can set up the requirements by using one or more of the following parameters:

  • Country/Region: Allow or deny requests that originate from the countries/regions specified by their country/region code.
  • URL: Allow only requests that match the specified asset or path.
  • Host: Allow or deny requests that use the specified hosts in the request header.
  • Referrer: Allow or deny request from the specified referrer.
  • IP address: Allow only requests that originated from specific IP address or IP subnet.
  • Protocol: Allow or deny requests based on the protocol used to request the content.
  • Expiration time: Assign a date and time period to ensure that a link remains valid only for a limited time period.

For more information, see the detailed configuration examples for each parameter in Setting up token authentication.

Important

If token authorization is enabled for any path on this account, standard-cache mode is the only mode that can be used for query string caching. For more information, see Control Azure CDN caching behavior with query strings.

 

Reference architecture

The following workflow diagram describes how the CDN uses token authentication to work with your web app.

 

 

Token validation logic on CDN endpoint

The following flowchart describes how Azure CDN validates a client request when token authentication is configured on CDN endpoint.

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(297)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2019-07-02 jQuery file upload callback options
2019-07-02 jQuery file upload process queue
2019-07-02 How do I add a simple onClick event handler to a canvas element?
2019-07-02 JavaScript 事件不触发
2019-07-02 jquery.fileupload-image-editor.js 中actions.resizeImage
2019-07-02 What's the difference between HEAD^ and HEAD~ in Git?
2017-07-02 Create the Project
点击右上角即可分享
微信分享提示