0
0
Nginxdevops~10 mins

Canary deployments in Nginx - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the upstream servers for canary deployment.

Nginx
upstream backend {
    server backend-v1.example.com;
    server [1];
}
Drag options to blanks, or click blank then click option'
Abackend-v2.example.com
Bbackend-test.example.com
Cbackend-old.example.com
Dbackend-v3.example.com
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing the old or unrelated server name instead of the new version.
2fill in blank
medium

Complete the code to split traffic with 90% to stable and 10% to canary.

Nginx
server {
    location / {
        proxy_pass http://backend;
        [1];
    }
}
Drag options to blanks, or click blank then click option'
Aproxy_set_header X-Weight 90 10
Bsplit_clients $request_id $upstream_server { 90% backend-v1; 10% backend-v2; }
Csplit_clients $request_id $upstream_server { 90% backend-v1.example.com; 10% backend-v2.example.com; }
Dproxy_set_header X-Canary 10%
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect directive names or wrong server names.
3fill in blank
hard

Fix the error in the canary header condition to route 10% traffic to canary.

Nginx
map $http_x_canary $upstream_canary {
    default backend-v1;
    [1] backend-v2;
}
Drag options to blanks, or click blank then click option'
A"10%"
B"canary"
C"1"
D"yes"
Attempts:
3 left
💡 Hint
Common Mistakes
Using percentage strings or numeric values that don't match the header.
4fill in blank
hard

Fill both blanks to complete the canary routing using the map variable.

Nginx
server {
    location / {
        proxy_pass http://[1];
        proxy_set_header X-Canary [2];
    }
}
Drag options to blanks, or click blank then click option'
Aupstream_canary
B$http_x_canary
C"yes"
D"no"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the raw header variable in proxy_pass or wrong header values.
5fill in blank
hard

Fill all three blanks to define a canary deployment with weighted upstream and header control.

Nginx
upstream backend {
    server backend-v1.example.com weight=[1];
    server backend-v2.example.com weight=[2];
}

server {
    location / {
        proxy_pass http://backend;
        proxy_set_header X-Canary [3];
    }
}
Drag options to blanks, or click blank then click option'
A90
B10
C"yes"
D"no"
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect weights or header values that don't match routing logic.