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

# Specify cache lifetime for user browsers

The Browser caching option controls how long CDN content is stored in end users' browsers. Two modes are available: **Origin controlled** and **CDN controlled**.

Use **Origin controlled** when the origin server already manages browser cache duration through response headers. Use **CDN controlled** to set a fixed expiry independently of origin configuration.

When **Origin controlled** is active, Gcore CDN passes the origin's `Cache-Control` header to browsers unchanged. If the origin sends no `Cache-Control`, browsers may apply heuristic caching if a `Last-Modified` header is present. If neither header is present, content is not cached in the browser.

When **CDN controlled** is active, Gcore CDN overrides origin cache headers and adds the following to each response:

* `Cache-Control` — sets the maximum browser cache time. A 12-hour expiry returns `Cache-Control: max-age=43200`.
* `Expires` — calculated from the current time plus the `max-age` value.

<Note>
  Browser caching applies to responses with codes 200, 201, 204, 206, 301, 302, 303, 304, 307, 308. Responses with other codes will not be cached.
</Note>

## Enable browser caching

To enable and configure browser caching on a CDN resource:

<Steps>
  <Step title="Navigate to CDN resources">
    In the [Gcore Customer Portal](https://portal.gcore.com), navigate to **CDN** and click the custom domain of the target resource.

    <Frame>
      <img src="https://mintcdn.com/gcore-doc-1894/p8h1t4ovqAJ5zxbi/images/docs/cdn/cdn-resource-options/cache/specify-cache-lifetime-for-user-browsers/specify-cache-lifetime-for-user-browsers-image1.png?fit=max&auto=format&n=p8h1t4ovqAJ5zxbi&q=85&s=369f83e90597f111d59cab0b26c58823" alt="CDN resources list with custom domain names" width="1400" height="900" data-path="images/docs/cdn/cdn-resource-options/cache/specify-cache-lifetime-for-user-browsers/specify-cache-lifetime-for-user-browsers-image1.png" />
    </Frame>
  </Step>

  <Step title="Open browser caching settings">
    In the **Cache** section, click **Browser caching**.

    <Frame>
      <img src="https://mintcdn.com/gcore-doc-1894/p8h1t4ovqAJ5zxbi/images/docs/cdn/cdn-resource-options/cache/specify-cache-lifetime-for-user-browsers/specify-cache-lifetime-for-user-browsers-image2.png?fit=max&auto=format&n=p8h1t4ovqAJ5zxbi&q=85&s=8235b6b9e32dc85f28cf49e8e819770e" alt="CDN resource settings with Browser caching toggle enabled and Origin controlled dropdown" width="1400" height="900" data-path="images/docs/cdn/cdn-resource-options/cache/specify-cache-lifetime-for-user-browsers/specify-cache-lifetime-for-user-browsers-image2.png" />
    </Frame>
  </Step>

  <Step title="Enable the toggle">
    Turn on the **Enable browser caching** toggle.
  </Step>

  <Step title="Select the caching mode">
    From the dropdown, select **Origin controlled** or **CDN controlled**. If Origin controlled is selected, the configuration is complete — proceed to save. For CDN controlled, configure the expiry using the expandable block.

    <Accordion title="Configure CDN controlled mode">
      From the list, select an expiry period. The recommended value is four days.

      <Frame>
        <img src="https://mintcdn.com/gcore-doc-1894/p8h1t4ovqAJ5zxbi/images/docs/cdn/cdn-resource-options/cache/specify-cache-lifetime-for-user-browsers/specify-cache-lifetime-for-user-browsers-image3.png?fit=max&auto=format&n=p8h1t4ovqAJ5zxbi&q=85&s=70563c88141d138bd84e7e0b20c8a35f" alt="Cache expiry dropdown in CDN controlled mode showing duration options" width="1400" height="900" data-path="images/docs/cdn/cdn-resource-options/cache/specify-cache-lifetime-for-user-browsers/specify-cache-lifetime-for-user-browsers-image3.png" />
      </Frame>

      To set a duration not in the list, select **Custom value** and enter the cache expiration time in seconds — to cache content for one day, enter `86400`.

      <Frame>
        <img src="https://mintcdn.com/gcore-doc-1894/p8h1t4ovqAJ5zxbi/images/docs/cdn/cdn-resource-options/cache/specify-cache-lifetime-for-user-browsers/specify-cache-lifetime-for-user-browsers-image4.png?fit=max&auto=format&n=p8h1t4ovqAJ5zxbi&q=85&s=1d008d3c6eab08c387b610450c5cf9e1" alt="Custom value field in CDN controlled mode with 86400 seconds entered" width="1400" height="900" data-path="images/docs/cdn/cdn-resource-options/cache/specify-cache-lifetime-for-user-browsers/specify-cache-lifetime-for-user-browsers-image4.png" />
      </Frame>
    </Accordion>
  </Step>

  <Step title="Save">
    Click **Save changes**.
  </Step>
</Steps>
