> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gcore.com/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 enables you to establish custom HTTP status codes for content hosted on the Gcore CDN, which can be applied based on a schedule.

For instance, in accordance with certain jurisdictions' laws, children under the age of 16 are not allowed to access specific content past 22:00. To comply with this regulation, the "Set status code" option can be configured to either send a 403 error code to users or redirect them to a different page when they attempt to access this restricted content. The schedule should be set such that this code is only activated after 22:00.

You can configure the option in two ways:

* Via **Resource settings** : the custom code will be applied to all the CDN resource's content -Via **Rules** : the custom code will be applied only to certain files

Select the appropriate method and click the desired tab below to learn how to configure this option.

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

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

    <Frame>
      <img src="https://mintcdn.com/gcore/dxycBbQXMfI-sCbi/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=dxycBbQXMfI-sCbi&q=85&s=18a1e314ae30f7a9cd888f5c23ca0be1" alt="Open settings of the special CDN resource" width="7068" height="1980" 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\. Click the **Content** section to open nested options.

    4\. Click **Status code**.

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

    <Frame>
      <img src="https://mintcdn.com/gcore/dxycBbQXMfI-sCbi/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=dxycBbQXMfI-sCbi&q=85&s=e4dd3412f8730377096a048b2c8de791" alt="Enable the Set status code option" width="5812" height="2412" 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\. Specify the desired HTTP status code in the field.

    <Caution>
      **Caution**

      You can't specify 408, 444, 494, 495, 496, 497, or 499 codes.
    </Caution>

    7\. (Optional) Specify a URL for a redirect or an HTTP status code text.

    8\. (Optional) Enable a schedule. In the expanded block, set the time when the custom status code will be applied, as well as the time zone.

    9\. Save changes.

    <Frame>
      <img src="https://mintcdn.com/gcore/dxycBbQXMfI-sCbi/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=dxycBbQXMfI-sCbi&q=85&s=2ecb8ab7b6fa9ff1a1226a6dc4885ee1" alt="Configure the Set status code option" width="3908" height="2780" 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>

    That's it! The custom code will be applied to all files delivered via the CDN.
  </Tab>

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

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

    <Frame>
      <img src="https://mintcdn.com/gcore/dxycBbQXMfI-sCbi/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=dxycBbQXMfI-sCbi&q=85&s=18a1e314ae30f7a9cd888f5c23ca0be1" alt="Open settings of the special CDN resource" width="7068" height="1980" 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\. Go 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/dxycBbQXMfI-sCbi/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=dxycBbQXMfI-sCbi&q=85&s=0393f8bb9c56e23127ece99241c6b123" alt="Open rules to set a custom code for specific files" width="7124" height="2044" 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 for custom code will be applied. Configure the other settings on the page. Our guide on [creating a rule manually](/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/dxycBbQXMfI-sCbi/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=dxycBbQXMfI-sCbi&q=85&s=f4fa03a13b717399c5a4902eacf201b5" alt="Add an option in the rule to set a custom code for specific files" width="3360" height="980" 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/dxycBbQXMfI-sCbi/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=dxycBbQXMfI-sCbi&q=85&s=f91f5d1095de6fa45a6a603885598a7a" alt="Apply the &#x22;Set custom code&#x22; option to the rule" width="3484" height="3020" 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\. Specify the desired HTTP status code in the field.

    <Caution>
      **Caution**

      You can't specify 408, 444, 494, 495, 496, 497, or 499 codes.
    </Caution>

    11\. (Optional) Specify a URL for a redirect or an HTTP status code text.

    12\. (Optional) Enable a schedule. In the expanded block, set the time when the custom status code will be applied, as well as the time zone.

    13\. Save changes.

    <Frame>
      <img src="https://mintcdn.com/gcore/dxycBbQXMfI-sCbi/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=dxycBbQXMfI-sCbi&q=85&s=e5053ce3453167d6d8c0c8f74efc28ac" alt="Configure the Set status code option in the rule" width="3672" height="3240" 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>

    That's it! The rule with the set custom code will be applied to specified files delivered via the CDN.
  </Tab>
</Tabs>
