# Security Link

## **Secure Token** <a href="#securitylink-securetoken" id="securitylink-securetoken"></a>

Secure tokens are structured codes that protect content from being stolen and distributed elsewhere. On vCDN, we support you to enable the Secure token feature when creating or editing a previously created CDN.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-1d45110ad8e30e550b0d682a950ce8efef7801a5%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

***

## Operational diagram <a href="#securitylink-sodohoatdong" id="securitylink-sodohoatdong"></a>

When the end user needs to access the content that has been set to activate the "Secure token", the system will check the request to see if it satisfies the formula or not. If it satisfies, the end user can get the content. If not, the request will be rejected.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-9eb0b4cb2d0a3757c66c7baff885e848a58dda5c%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

In there:

* **Passphase** : is the key that comes with the formula you have set up so that the system can recognize that access has been granted.
* **Include client IP** : is the IP of the end user requesting content.
* For "Secure token" to work, the service administrator needs to integrate KEY into the system. Depending on the Token Type, there will be different KEY generation formulas, specifically:
  * **VNG** :
    * **URL Format** : http(s)://\<domain>/\<token>/\<expiredTime>/\<uri>
    * **\<token>** : md5(\<Passphare>\<filePath>\<expiredTime>\<clientIP>)
    * **\<expiredTime>:** The URL's expiration epochtime, in milliseconds
    * **\<filePath>** : /path/to/media/xxx.\[m3u8|ts|mpd|dash] (ie \<uri> leaves out the xxx.\[m3u8|ts|mpd|dash] part, in this example it would be: /path/to/media)
    * **\<ClientIP>** : The IP of the client that is authorized to access the content, provided only in case you have selected to enable "Include IP" in the CDN service configuration
    * Example: <http://abcxyz.vcdn.cloud/cb0a229fa7a81c219c0c0f964f9b6e68/1603691495000/test/index.m3u8>
  * **SBD** :
    * **URL Format** : http(s)://\<domain>/\<token>/\<expiredTime>/\<uri>
    * **\<token>** : md5(\<clientIP> **:<** Passphare> **:** \<exiredTime> **:** \<filePath>)
    * **\<expiredTime>** : The URL's expiration epochtime, in seconds
    * **\<filePath>:/path/to/media** /xxx.\[m3u8|ts|mpd|dash] (ie \<uri> leaves out the xxx.\[m3u8|ts|mpd|dash], in this example it would be: /path/to/media)
    * **\<ClientIP>** : The IP of the client that is authorized to access the content, provided only in case you have selected to enable "Include IP" in the CDN service configuration
  * **Akamai** :
    * Refer to the instructions from Akamai's document at: <https://learn.akamai.com/en-us/webhelp/adaptive-media-delivery/adaptive-media-delivery-implementation-guide/GUID-041AEFDE-7E25-4AD8-B6C4-73F1B7200F02.html>

***

## **Using CORS feature** <a href="#securitylink-sudungtinhnangcors" id="securitylink-sudungtinhnangcors"></a>

CORS is a vCDN output security feature that allows access with configurations such as: domain name, IP address, Header, Method, Expose Header to access the vCDN output Link.

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-5f16ad87210c63eb6bd65c4db6f2996183f1c06a%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

***

## **Create a Whitelist / Blacklist IP** <a href="#securitylink-khoitaowhitelist-blacklistip" id="securitylink-khoitaowhitelist-blacklistip"></a>

* **WhiteList IP:** You can add IP lists of Origins that are allowed to access the output link by selecting **Allow** and entering **the IP Address** or **CIDR** you want:

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-4089e785c4a3493013a15fff7805022c1da57833%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

* **BlackList IP:** In addition, you can also block IPs that do not allow Origin to access the output link of vCDN:

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-f746c7b5c70a58e7f65d1e4a3763b7921827225c%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

***

## **Geo Block** <a href="#securitylink-geoblock" id="securitylink-geoblock"></a>

* Additionally, you can create a list of origins in which countries the output link can be accessed by selecting **Allow** and entering the desired **country code :**

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-81b065923eec54d13f6fb03c0a7289f028ddb0b7%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

* You can also set to not allow Origins in a certain country to access the output link by selecting **Block** and entering the desired **country code :**

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-154842f7dec32e15ac6bc277ae9b18371e6ef1ba%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

***

## **HTTP Referer Block** <a href="#securitylink-httprefererblock" id="securitylink-httprefererblock"></a>

* You can allow Origins with domains in the list to access the output link by selecting **Allow** and entering the desired **domain :**

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-5ad5bb480bdfb975327ad574eb1b402866d40217%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

* Finally, you can disallow Origin to have domains in the list that can access the output link by selecting **Block** and entering the desired **domain :**

<figure><img src="https://1985221522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7rE7M1L7GYcwQzNGd0aB%2Fuploads%2Fgit-blob-6748d7cff4973ae06b7c051373b0b7d348882517%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vngcloud.vn/vng-cloud-document/vcdn/chi-tiet-tinh-nang/security-link.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
