> ## Documentation Index
> Fetch the complete documentation index at: https://gcore-doc-1894.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a CDN resource rule template manually or use a system one

A template is a preset rule for CDN resources — it contains all necessary settings: file paths, an origin pull protocol, and enabled and disabled options. Adding a rule from a template takes three clicks: open the **Rules** tab, select a template, and click **Create rule**.

Gcore provides built-in templates called **System**. Custom templates can also be created.

## Create a template

Configure the file paths, origin pull protocol, and any additional options to define a reusable rule template.

1\. In the CDN resource settings, open the **Rules** tab, navigate to the **Templates** section and click **Create template**.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/rules-for-particular-files/create-a-cdn-resource-rule-template-manually-or-use-a-system-one/templates-list.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=28dce3fc5afa9f7af936f22718433ecc" alt="Templates page showing system templates list and Create template button" width="1269" height="534" data-path="images/docs/cdn/cdn-resource-options/rules-for-particular-files/create-a-cdn-resource-rule-template-manually-or-use-a-system-one/templates-list.png" />
</Frame>

Complete the remaining steps on the **Create template** page.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/rules-for-particular-files/create-a-cdn-resource-rule-template-manually-or-use-a-system-one/create-template-form.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=aa9e513f7e574cadfffb520865355943" alt="Create template form with Template name, Match criteria, Origin pull protocol, and Options fields" width="608" height="609" data-path="images/docs/cdn/cdn-resource-options/rules-for-particular-files/create-a-cdn-resource-rule-template-manually-or-use-a-system-one/create-template-form.png" />
</Frame>

2\. Specify the template name. Templates can be searched by name after creation.

3\. Specify the path to the file or folder for which the rule will be applied. The path must start with `^/` or `/`. URLs and [regular expressions](https://en.wikipedia.org/wiki/Regular_expression) are both supported.

4\. Select the protocol that the CDN resource will use to pull the files specified at Step 3. If files are accessible over the same protocol as an origin, select **Inherit from resource**. If not, select the appropriate option: HTTP, HTTPS or both protocols at once.

5\. (Optional) View the list of additional options and configure the necessary ones.

6\. Click **Create template**.

## Use a system template

System templates are built-in presets covering common CDN use cases. They are labeled **System** in the Templates section.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/rules-for-particular-files/create-a-cdn-resource-rule-template-manually-or-use-a-system-one/templates-list.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=28dce3fc5afa9f7af936f22718433ecc" alt="Templates page with five system templates each labeled System" width="1269" height="534" data-path="images/docs/cdn/cdn-resource-options/rules-for-particular-files/create-a-cdn-resource-rule-template-manually-or-use-a-system-one/templates-list.png" />
</Frame>

**Video segments template (.ts)** is a rule template for caching chunks ([streaming via CDN](/cdn/getting-started/create-a-cdn-resource/create-a-cdn-resource-for-video-streaming#create-a-cdn-resource-for-video-streaming)).

**Playlists template (.m3u8)** is a rule template for caching playlists ([streaming via CDN](/cdn/getting-started/create-a-cdn-resource/create-a-cdn-resource-for-video-streaming#create-a-cdn-resource-for-video-streaming)).

**Let's Encrypt HTTP-01 challenge** is a rule template for validating a Let's Encrypt certificate that is issued with the [HTTP-01 challenge](https://letsencrypt.org/docs/challenge-types) method and not via the Gcore UI. For the certificate to be validated, create a CDN resource, create a rule from the template, and only then request a certificate. Without this rule, the resource settings will block certificate validation.

**Static content** is a rule template for caching static files of the resources integrated with the DNS.

**Image optimization** is a rule template for optimizing images using [Image Stack](/cdn/cdn-resource-options/image-optimization-paid/about-image-stack) (paid add-on; [enable Image Stack](/cdn/cdn-resource-options/image-optimization-paid/enable-image-stack) in the resource options before using this template). Add a rule from the Image optimization template to the resource, and image optimization will be applied to matching files. To optimize only specific files, edit the file path when creating the rule.

## Create a rule from a template

Applying a template pre-fills the rule form with saved settings, so only final adjustments are needed before saving.

1\. Open the settings of the required CDN resource. In the **Rules** tab, click **Create rule** and select a template from the list.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/rules-for-particular-files/create-a-cdn-resource-rule-template-manually-or-use-a-system-one/create-rule-dropdown.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=3a060190359a9e1c6c1b0f267bc15c6e" alt="Create rule dropdown showing Create blank rule option and system templates list" width="1270" height="291" data-path="images/docs/cdn/cdn-resource-options/rules-for-particular-files/create-a-cdn-resource-rule-template-manually-or-use-a-system-one/create-rule-dropdown.png" />
</Frame>

2\. The form opens with pre-filled settings from the template. Review the settings and edit them if needed.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/rules-for-particular-files/create-a-cdn-resource-rule-template-manually-or-use-a-system-one/create-rule-from-template.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=2def501ab09a06e3abf560afde9e5e73" alt="Create rule form pre-filled with settings from the selected template" width="645" height="852" data-path="images/docs/cdn/cdn-resource-options/rules-for-particular-files/create-a-cdn-resource-rule-template-manually-or-use-a-system-one/create-rule-from-template.png" />
</Frame>

3\. Click **Create rule**.
