Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browser-only cache-control - Not CDN

I'd like to apply this to browsers:

header('Cache-Control: max-age=3600');

But apply this to my CDN:

header("Cache-Control: no-cache");

In other words I want the CDN to treat it as dynamic content but browsers to still store the response in their local cache. Is there any standard way of doing this?

like image 229
Amy Neville Avatar asked Apr 05 '16 23:04

Amy Neville


People also ask

Is CDN same as cache?

What is the difference between CDNs and caching? CDNs are geographically distributed networks of proxy servers and their objective is to serve content to users more quickly. Caching is the process of storing information for a set period of time on a computer.

Does browser cache CDN?

Web browsers cache HTML files, JavaScript, and images in order to load websites more quickly, while DNS servers cache DNS records for faster lookups and CDN servers cache content to reduce latency.

How do I disable the CDN cache?

To disable the CDN Go to Performance>General settings and disable the CDN. make sure to save all settings and purge the cache. This will disable the CDN and purging the cache will allow the files to be visible again and served from your server. You can then simply re-enable the CDN again when you choose to do so.

How does cache-control work in a Web browser?

Cache-controlTells the browser to not cache the content in any way. It is mostly used when dealing with sensitive data or with data that changes frequently. Marks the content as public, which means it can be cached by the browser and any intermediary parties (such as proxies, etc).


1 Answers

You can do that with

Cache-Control: private, max-age=3600

So that an eventual CDN/intermediate proxy is bypassed.

like image 67
Federkun Avatar answered Oct 15 '22 22:10

Federkun