Cache-Control Header Generator
Pick your caching directives and copy the exact Cache-Control header — plus ready-to-paste nginx and Apache snippets. Runs entirely in your browser; nothing is sent anywhere.
1 · Choose directives
2 · Copy the result
There are two ways to do this on CDN.com.tr. Publish this header from your own origin and, on a rule set to Follow your origin's cache headers, the edge follows it — and the header reaches the browser unchanged. Or write no header at all and set the TTL per path with Cache for a fixed time on the Rules tab of Domains & Rules in the panel. One or the other per rule, not both.
What each Cache-Control directive does
The Cache-Control header tells browsers and CDN/proxy caches whether, where and how long they may store a response. Getting it right is one of the biggest wins for page speed and origin load. Here's what each directive above means.
public vs private
public lets any cache — including a CDN or shared proxy — store the response. private restricts storage to the end user's browser only; use it for personalized or authenticated responses that must never be served to another user.
max-age & s-maxage
max-age=N is how many seconds the response stays "fresh" (served without revalidation). s-maxage=N overrides max-age for shared caches (your CDN), so you can cache long at the edge while keeping browsers on a shorter window — e.g. max-age=0, s-maxage=3600.
no-cache vs no-store
They sound similar but differ: no-cache allows caching but forces revalidation with the origin before every reuse (good for HTML that changes). no-store forbids caching entirely — nothing is written to any cache; use it for sensitive, per-request data.
stale-while-revalidate & stale-if-error
stale-while-revalidate=N lets a cache serve a slightly stale response instantly while it refreshes in the background — visitors never wait on the origin. stale-if-error=N serves the last good copy if the origin is down, keeping your site up during incidents.
immutable
Signals that the content will never change during its max-age, so browsers skip revalidation even on reload. Ideal for fingerprinted/hashed static assets like app.9f2c1.js — pair with a long max-age: public, max-age=31536000, immutable.
must-revalidate & proxy-revalidate
Once a response becomes stale, must-revalidate forbids serving it without checking the origin first (no silent stale delivery). proxy-revalidate applies the same rule to shared caches only, leaving browsers more leeway.
Common recipes
Hashed static asset: public, max-age=31536000, immutable — cache "forever", the hash changes when the file does.
HTML behind a CDN: public, max-age=0, s-maxage=3600, stale-while-revalidate=86400 — browsers always revalidate, the edge serves cached HTML and refreshes in the background.
Personalized/authenticated: private, no-store — never cached by the CDN or shared proxies.
Want these rules applied automatically?
Publish the header from your origin and CDN.com.tr follows it; if you would rather not, set the same durations per path from the panel. Edge caching, Auto SSL and WAF are included either way.