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?
✗ Incorrect
The 'no-cache' directive requires the client to revalidate with the server before using the cached response.
How do you add a Cache-Control header in nginx?
✗ Incorrect
The correct syntax in nginx is 'add_header Cache-Control "value";' inside the server or location block.
What does the Cache-Control directive
public mean?✗ Incorrect
'public' means the response can be cached by browsers and shared caches like proxies.
If you want to prevent any caching of a response, which directive should you use?
✗ Incorrect
'no-store' prevents the response from being saved in any cache.
What happens if you set
max-age=0 in Cache-Control?✗ Incorrect
'max-age=0' means the cached response expires immediately and requires revalidation.
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.