The Browser Caching option allows you to set the period of content caching in the end users' browser. The option has two modes: Origin controlled and CDN controlled. The difference between these two modes is that in the first case, the caching time is configured in your source site's configuration, and in the second case, in the Gcore control panel.
If you choose the Origin controlled mode, the content will be cached based on the origin settings specified in the Cache-Control header. For example, if your Cache-Control header is set as Cache-Control: max-age=172800 on your origin in seconds, the content will be cached for 2 days on the CDN servers.
If the Cache-Control header is not specified, then most browsers will consider the Last-Modified header to decide how to handle files in the cache.
Note: The content will not be cached if there are no cache settings on your origin.
If you choose the CDN controlled mode, the content will be cached based on the cache duration set for this option in the control panel. You can select a value from the list or set a custom value in seconds.
Note: Here are the HTTP response codes that can be cached in browsers: 200, 201, 204, 206, 301, 302, 303, 304, 307, 308. Other response codes will not be cached.
If the CDN controlled is selected, the following will be added to the response headers:
"NOW()" + Cache-Control->max-agetelling the client browser to keep this object in cache for the amount of time specified by the max-age parameter in the Cache-Control header.
1. Go to the CDN resources section.
2. Click the custom domain name of the CDN resource for which you want to configure Browser Caching.
The new page opens. Perform the remaining steps there.
3. Click on the Cache and then select the Browser Caching option.
4. Toggle on Enable browser caching.
5. Select Origin controlled or CDN controlled in the list. If you set Origin controlled, the configuration is complete; continue to step six. If you select CDN controlled, follow the instructions in the expandable block.
You can also choose “Custom value” to set an expiry period not presented in the list. For the custom value, you should specify the expiry period in seconds. For instance, if you want to cache content for one day, you need to enter 86400, as there are 86400 seconds in a day.
6. Save changes.
Was this article helpful?
Learn more about our next-gen CDN