Cache-Control Header Generator

Ek correct HTTP Cache-Control response header banayein simple toggles aur human time units se, seedhe aapke browser mein.

Aapka Cache-Control header locally aapke browser mein aapke chune options se assemble hota hai, aur jo aap configure karte hain woh kuch bhi upload ya server par store nahi hota.

Server wire up kar rahe hain? nginx Config Generator try karein.

Cache-Control Header Generator ke baare mein

Yeh cache-control header generator HTTP caching directives ke confusing set ko chand simple toggles mein badal deta hai. public ya private, no-store, no-cache, must-revalidate, proxy-revalidate ya immutable flip karein, aur max-age, s-maxage, stale-while-revalidate aur stale-if-error jaise lifetimes hours, days ya years jaise human units mein set karein bajaye seconds ginne ke. Jaise aap options badalte hain, tool directives ko canonical order mein compose karta hai, plain English mein exactly samjhata hai ki current header kya karta hai, aur no-store ke saath max-age jaise contradictory combinations flag karta hai. Presets rozmarra ke cases cover karte hain: ek one-year immutable static asset, always-revalidate HTML, never-store private data, aur ek split CDN-versus-browser policy. Raw header ya ready-made nginx, Apache aur HTML meta snippets copy karein. Sab kuch aapke device par, browser mein chalta hai.

Features

Cache-Control Header Generator kaise use karein

  1. Ek preset chunein ya scratch se shuru karein aur public ya private choose karein.
  2. Jo directives chahiye toggle karein, jaise no-cache, must-revalidate ya immutable.
  3. max-age jaise lifetimes ek number aur ek unit (hours, days, years) se enter karein.
  4. Generated header value aur uske neeche ki plain-English explanation padhein.
  5. Jo chahiye woh raw header ya nginx, Apache ya HTML meta snippet copy karein.

Example

Input

public + immutable + max-age = 1 year

Output

Cache-Control: public, max-age=31536000, immutable

Classic fingerprinted static-asset policy: ek saal ke liye cache karein aur kabhi revalidate na karein.

Common errors aur troubleshooting

Aksar pooche jaane wale sawaal

no-cache aur no-store mein kya difference hai?
no-store ka matlab response kabhi kisi cache mein likha nahi jaana chahiye, isliye har request wapas origin par jaati hai. no-cache response store karne deta hai, par cache ko use dobara serve karne se pehle origin ke saath revalidate karna hoga. no-store copy na rakhne ke baare mein hai; no-cache hamesha check karne ke baare mein hai ki rakhi copy abhi bhi current hai.
Cache-Control header mein immutable kya karta hai?
immutable browser ko batata hai ki resource apne max-age ki lifetime mein kabhi nahi badlega, isliye woh reload par bhi revalidation skip kar sakta hai. Yeh app.9f2c.js jaise versioned ya fingerprinted files ke liye hai, jahan naya build purani ko overwrite karne ke bajaye naye URL par ship hota hai.
max-age aur s-maxage kaise differ karte hain?
max-age set karta hai response kisi bhi cache mein, including browser, kitni der fresh rehta hai. s-maxage max-age ko override karta hai par sirf shared caches jaise CDNs aur proxies ke liye. Dono set karne se aap response ko browsers mein thodi der cache karke apne CDN par zyada der rakh sakte hain.
public ya private kab use karun?
public shared caches jaise CDNs aur proxies ko browser ke saath response store karne deta hai. private storage ko individual user ke browser tak restrict karta hai, jo personalized ya authenticated responses ke liye sahi choice hai jo shared cache se kisi doosre user ko serve nahi hone chahiye.
stale-while-revalidate kya karta hai?
stale-while-revalidate ek cache ko thoda stale response turant serve karne deta hai jabki woh background mein ek fresh copy fetch karta hai. Users ko instant response milta hai aur cache agli request ke liye khud ko update kar leta hai, jo resource expire hone ke moment ko smooth kar deta hai.
Kya meri configuration server par bheji jaati hai?
Nahi. Header, explanation aur snippets sab aapke browser mein assemble hote hain jaise aap options toggle karte hain, isliye configuration locally aapke device par process hoti hai aur kuch upload nahi hota.

Related tools

Saare ArrayKit tools