Bird
0
0

What will happen if a server sends the header Cache-Control: max-age=-100 in an HTTP response?

medium📝 Debug Q6 of 15
Rest API - Request and Response Format
What will happen if a server sends the header Cache-Control: max-age=-100 in an HTTP response?
AThe server will automatically correct the value to zero.
BThe negative max-age will be interpreted as a very long cache duration.
CThe client will ignore the Cache-Control header entirely.
DThe max-age value is invalid, so the response will be treated as immediately stale.
Step-by-Step Solution
Solution:
  1. Step 1: Understand max-age directive

    The max-age directive specifies the maximum amount of time a resource is considered fresh.
  2. Step 2: Analyze negative values

    Negative values for max-age are invalid and treated as if the resource is stale immediately.
  3. Final Answer:

    The max-age value is invalid, so the response will be treated as immediately stale. -> Option D
  4. Quick Check:

    Negative max-age means stale cache [OK]
Quick Trick: Negative max-age means resource is immediately stale [OK]
Common Mistakes:
  • Assuming negative max-age means long cache time
  • Thinking the header is ignored
  • Believing the server auto-corrects invalid values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes