0
0
Nginxdevops~20 mins

Streaming and chunked transfer in Nginx - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Chunked Transfer Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding chunked transfer encoding in nginx

What does enabling chunked_transfer_encoding on; in nginx do?

AIt caches the entire response on disk before sending it to the client.
BIt compresses the response data before sending it to the client.
CIt disables buffering of the response and sends it all at once after completion.
DIt allows nginx to send response data in chunks without knowing the full content length beforehand.
Attempts:
2 left
💡 Hint

Think about how data can be sent when the total size is unknown.

💻 Command Output
intermediate
2:00remaining
Output of nginx log with chunked transfer

Given nginx is configured with chunked_transfer_encoding on; and serves a large file, what will the Content-Length header show in the response?

ANo <code>Content-Length</code> header will be present; instead, <code>Transfer-Encoding: chunked</code> will be set.
B<code>Content-Length</code> will show the full size of the file in bytes.
C<code>Content-Length</code> will show zero.
D<code>Content-Length</code> will show the size of the first chunk only.
Attempts:
2 left
💡 Hint

Chunked transfer replaces the need for a content length header.

Configuration
advanced
2:30remaining
Configuring nginx for streaming large files

Which nginx configuration snippet correctly enables streaming of large files using chunked transfer encoding?

A
location /files/ {
    proxy_pass http://backend;
    proxy_buffering on;
    chunked_transfer_encoding on;
}
B
location /files/ {
    proxy_pass http://backend;
    proxy_buffering on;
    chunked_transfer_encoding off;
}
C
location /files/ {
    proxy_pass http://backend;
    proxy_buffering off;
    chunked_transfer_encoding on;
}
D
location /files/ {
    proxy_pass http://backend;
    proxy_buffering off;
    chunked_transfer_encoding off;
}
Attempts:
2 left
💡 Hint

Streaming requires buffering off and chunked transfer enabled.

Troubleshoot
advanced
2:30remaining
Troubleshooting missing chunked transfer encoding

You enabled chunked_transfer_encoding on; in nginx, but clients still receive a Content-Length header and no chunked transfer. What is a likely cause?

AThe client does not support chunked transfer encoding.
BThe response is fully buffered by nginx because <code>proxy_buffering</code> is still enabled.
CThe <code>chunked_transfer_encoding</code> directive is deprecated and ignored.
DThe backend server is sending a <code>Transfer-Encoding</code> header that conflicts with nginx.
Attempts:
2 left
💡 Hint

Check if buffering is disabled to allow streaming.

🔀 Workflow
expert
3:00remaining
Order of steps to enable streaming with chunked transfer in nginx

Arrange the steps in the correct order to enable streaming of dynamic content using chunked transfer encoding in nginx.

A4,1,2,3
B2,1,4,3
C1,2,4,3
D1,4,2,3
Attempts:
2 left
💡 Hint

Think about backend readiness before nginx settings and reload.