0
0
Nginxdevops~5 mins

Cache-Control headers in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the Cache-Control header in HTTP?
The Cache-Control header tells browsers and other clients how to store and reuse responses to speed up loading times and reduce server load.
Click to reveal answer
beginner
What does the Cache-Control directive no-cache mean?
It means the client must check with the server before using a cached copy, ensuring the content is fresh.
Click to reveal answer
beginner
How do you set Cache-Control headers in nginx configuration?
Use the add_header Cache-Control "value"; directive inside a server or location block.
Click to reveal answer
beginner
What does the Cache-Control directive max-age=3600 do?
It tells the client to keep the cached response for 3600 seconds (1 hour) before checking for a new version.
Click to reveal answer
intermediate
What is the difference between no-store and no-cache in Cache-Control?
no-store means do not save the response anywhere, while no-cache means save but always revalidate before use.
Click to reveal answer
Which Cache-Control directive tells the browser to store the response but always check with the server before using it?
Apublic
Bno-store
Cmax-age=3600
Dno-cache
How do you add a Cache-Control header in nginx?
Aadd_header Cache-Control "max-age=3600";
Bcache_control max-age=3600;
Cset_header Cache-Control max-age=3600;
Dcache-control add max-age=3600;
What does the Cache-Control directive public mean?
AThe response cannot be cached.
BThe response can be cached by any cache, even shared ones.
CThe response is private to the user.
DThe response must be revalidated every time.
If you want to prevent any caching of a response, which directive should you use?
Ano-store
Bmax-age=0
Cpublic
Dmust-revalidate
What happens if you set max-age=0 in Cache-Control?
AThe response is cached forever.
BThe response is cached for 0 seconds and then deleted.
CThe cached response is considered stale immediately and must be revalidated.
DThe response is never cached.
Explain how Cache-Control headers affect browser caching behavior and why they are important in nginx configurations.
Think about how browsers decide to reuse or refresh content.
You got /4 concepts.
    Describe the difference between the Cache-Control directives no-cache and no-store with examples of when to use each.
    Focus on whether the response is saved or not.
    You got /4 concepts.