Last update:2025-03-24 10:21:48
URL authentication is a sophisticated content protection strategy that enhances security compared to traditional access control measures like IP whitelists/blacklists, Referer, Cookie, and User-Agent checks. This method embeds authentication information directly within the content URL, such as timestamps and encrypted strings. When a user requests content from a Content Delivery Network (CDN), they must present a URL containing the valid authentication details. The CDN then verifies this information to determine whether to grant or deny access, effectively preventing unauthorized use of content URLs.
The typical URL authentication process involves the following key components:
Consider a scenario where you need to protect an image file located at http://example.com/test.jpg
. The URL authentication process would proceed as follows:
http://example.com/test.jpg?token=123
. This authenticated URL is then returned to the user.token
parameter). If the authentication is successful, the CDN serves the test.jpg
image to the client. If the authentication fails (e.g., the token is invalid or expired), the CDN denies the request.Scope of Effectiveness
You can typically define the scope of requests to which URL authentication will be applied. Common options include:
Setting | Description |
---|---|
All Requests | Apply URL authentication to all types of requests for the specified domain. |
Only Homepage | Restrict URL authentication to requests for the root directory of the domain (e.g., http://domain/ or https://domain/). |
Specified File Type | Applies only to specific types of files. You can select from the predefined file types on the left or define custom file types. Separate multiple custom types with a semicolon ; .(e.g., jpg;png ). |
Specified URI | Define specific URIs to which URL authentication should apply. Options might include: Exact matching: Matches the full URI, including any query parameters (e.g., path/index.html?abc=123 ). Ignore the parameter matching: URI without query parameters.(e.g., path/index.html ). |
Specified Directory | Apply URL authentication to all requests for content within specific directories (e.g., /file/abc/ will affect all content under http://domain/file/abc/*). Ensure that directory paths start and end with / and contain only letters, numbers, and the special characters _ , % , and . . Separate multiple directories with line breaks. |
URL Pattern | Use regular expressions to define the scope of requests. For example, .jpg$ would apply to all URLs ending with .jpg . |
Authentication Mode
You can select from five authentication modes available on the CDNetworks Console, each tailored to different needs and situations:
Due to the complexity of URL authentication settings, it is advisable to deploy configurations to a test environment first to avoid impacting your live operations. Once verified as correct, you can apply them to the production environment. For detailed guidance on deploying the configurations to a test environment, refer to Verify Configurations Through Pre-Deployment.
Additionally, you can use the Timestamp Anti-Hotlinking Calculator available on the CDN Console to automatically generate URL authentication parameters for test and verify whether the authentication parameters will be successfully passed by the CDN edge servers. For more on how to use this tool, visit Timestamp Anti-Hotlinking Calculator.