Which HTTP header helps browsers cache content to reduce repeated downloads?
Think about headers that tell browsers how long to keep files.
The Cache-Control header tells browsers how long to store content locally, reducing repeated downloads and speeding up page loads.
Given this nginx config snippet enabling gzip compression, what will be the Content-Encoding header in the response?
gzip on; gzip_types text/plain application/json;
Check which compression method nginx uses when gzip is enabled.
When gzip is enabled, nginx compresses matching content types and adds Content-Encoding: gzip header to tell browsers the content is compressed.
Put these steps in the correct order to enable gzip compression for JSON responses in nginx.
Think about configuring first, then applying, then testing.
First enable gzip, then specify types, reload nginx to apply, and finally test headers.
After enabling gzip and adding gzip_types application/json;, JSON responses are still not compressed. What is a likely cause?
Compression only happens if the client asks for it.
nginx compresses responses only if the client sends Accept-Encoding: gzip header. Without it, nginx skips compression.
Choose the best set of headers to optimize delivery of compressed static files with caching in nginx.
Think about long caching and correct compression header.
Using Cache-Control: max-age=31536000, immutable allows browsers to cache files for a year without revalidation. Content-Encoding: gzip indicates compressed content. This combination speeds delivery and reduces bandwidth.