> ## 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.

# Configuring HTTP status codes for CDN-hosted content

export const Caution = ({children}) => {
  return <div class="my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border danger-admonition dark:danger-admonition">
      <div class="mt-0.5 w-4">
        <svg width="14" height="14" viewBox="0 0 14 14" fill="rgb(239, 68, 68)" xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 text-sky-500" aria-label="Danger">
          <path fill-rule="evenodd" clip-rule="evenodd" d="M7 1.3C10.14 1.3 12.7 3.86 12.7 7C12.7 10.14 10.14 12.7 7 12.7C5.48908 12.6974 4.0408 12.096 2.97241 11.0276C1.90403 9.9592 1.30264 8.51092 1.3 7C1.3 3.86 3.86 1.3 7 1.3ZM7 0C3.14 0 0 3.14 0 7C0 10.86 3.14 14 7 14C10.86 14 14 10.86 14 7C14 3.14 10.86 0 7 0ZM8 3H6V8H8V3ZM8 9H6V11H8V9Z"></path>
        </svg>
      </div>
      <div class="text-sm prose min-w-0">
        {children}
      </div>
    </div>;
};

The **Set status code** option defines a custom HTTP status code for content hosted on a CDN resource. The code can be applied globally to all resource content or selectively to specific files via Rules. A schedule with an **Apply from** and **Until** time range lets the code activate only during certain hours.

A common use case is age-restricted content compliance — return a 403 error code or redirect users to a different page after 22:00, and configure the schedule to activate the code only during the restricted hours.

The option is available in two places:

* Via **Resource settings** — applies the custom code to all content on the CDN resource.
* Via **Rules** — applies the custom code only to files matching the rule pattern.

Select the appropriate tab below.

<Tabs>
  <Tab title="Resource settings">
    1. In the [Gcore Customer Portal](https://portal.gcore.com), navigate to **CDN** > **CDN resources**.

    2. Click the CNAME of the required CDN resource to open **Resource settings**.

    <Frame>
      <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-10.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=01550cc89f183fc6faa5300501868dd7" alt="CDN resources list" width="1142" height="436" data-path="images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-10.png" />
    </Frame>

    3. Navigate to the **OPTIONS** tab.

    4. In the left menu, click **Content** to scroll to the Content section.

    5. Enable the **Set status code** toggle.

    <Frame>
      <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-20.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=f52a92c7e2f6a20a5a00bdc8f357b95a" alt="Enable the Set status code option" width="530" height="658" data-path="images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-20.png" />
    </Frame>

    6. In the **Status code** field, enter the desired HTTP status code. The field defaults to **200**.

    <Caution>
      **Caution**

      Codes 408, 444, 494, 495, 496, 497, and 499 are not accepted.
    </Caution>

    7. (Optional) In the **URL or code text** field, enter a redirect URL or an HTTP status code text.

    8. (Optional) Select **Apply on schedule**. In the expanded block, set **Apply from**, **Until**, and **Timezone** to define the time range when the custom status code is active.

    9. Click **Save changes**.

    <Frame>
      <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-30.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=d7d6ffb9456161b53adfb7bb1e224124" alt="Configure the Set status code option" width="534" height="418" data-path="images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-30.png" />
    </Frame>

    The custom code is now applied to all files delivered via the CDN resource.
  </Tab>

  <Tab title="Rules">
    1. In the [Gcore Customer Portal](https://portal.gcore.com), navigate to **CDN** > **CDN resources**.

    2. Click the CNAME of the required CDN resource to open **Resource settings**.

    <Frame>
      <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-10.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=01550cc89f183fc6faa5300501868dd7" alt="CDN resources list" width="1142" height="436" data-path="images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-10.png" />
    </Frame>

    3. Navigate to the **RULES** tab.

    4. Click **Create rule**.

    5. In the menu that opens, click **Create blank rule**.

    <Frame>
      <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-50.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=e02657a4e163607acdc7c628709906cc" alt="Open rules to set a custom code for specific files" width="1400" height="900" data-path="images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-50.png" />
    </Frame>

    On the page that opens, specify to which files the rule applies. Configure the other settings on the page. The guide on [creating rules](/cdn/cdn-resource-options/rules-for-particular-files/create-a-rule-manually-or-from-a-template-to-configure-settings-for-particular-files#create-a-rule-manually) explains the configuration options in depth.

    6. At the end of the page, click **Add option**.

    <Frame>
      <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-60.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=349f07c1d4ff8451701e74d75e5ef9d2" alt="Add an option in the rule" width="560" height="793" data-path="images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-60.png" />
    </Frame>

    7. Click **Status code** in the list to add the option to the rule.

    8. Click **Close**.

    <Frame>
      <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-70.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=0b70327855418bda7e8d3b9c05aec082" alt="Status code option in the list" width="639" height="785" data-path="images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-70.png" />
    </Frame>

    9. Enable the **Set status code** toggle.

    10. In the **Status code** field, enter the desired HTTP status code. The field defaults to **200**.

    <Caution>
      **Caution**

      Codes 408, 444, 494, 495, 496, 497, and 499 are not accepted.
    </Caution>

    11. (Optional) In the **URL or code text** field, enter a redirect URL or an HTTP status code text.

    12. (Optional) Select **Apply on schedule**. In the expanded block, set **Apply from**, **Until**, and **Timezone** to define the time range when the custom status code is active.

    13. Click **Create rule**.

    <Frame>
      <img src="https://mintcdn.com/gcore-doc-1894/9U1xXa0egFyWElxm/images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-80.png?fit=max&auto=format&n=9U1xXa0egFyWElxm&q=85&s=c01de5e054806dbc5691c2b9017a61fa" alt="Configure the Set status code option in the rule" width="601" height="668" data-path="images/docs/cdn/cdn-resource-options/specify-custom-http-status-code-for-the-content-delivered-by-the-cdn/set-custom-code-80.png" />
    </Frame>

    The rule with the custom status code is now applied to the specified files delivered via the CDN.
  </Tab>
</Tabs>
