Skip to content
Foxipa
Code Completion 5 Challenges

Complete the config: Nginx Dynamic Upstreams

Fill in resolvers, valid periods, and variable-driven proxy_pass.

Advanced ~4 min read

Challenge 1

Point the worker at the cluster DNS.

nginx Your answer
location / {
     127.0.0.53 valid=30s ipv6=off;
    proxy_pass http://$backend;
}

Press Ctrl⌘Enter to check your answer

Challenge 2

Re-resolve every 15 seconds regardless of the record's TTL.

nginx Your answer
resolver 10.0.0.10 =15s;

Press Ctrl⌘Enter to check your answer

Challenge 3

Pick the backend name at request time.

nginx Your answer
location / {
    ;
    resolver 10.0.0.10 valid=30s;
}

Press Ctrl⌘Enter to check your answer

Challenge 4

Resolve an upstream server name at runtime inside the upstream block.

nginx Your answer
upstream api {
    server api.internal.svc:8080 ;
}

Press Ctrl⌘Enter to check your answer

Challenge 5

Share the upstream's runtime state across workers.

nginx Your answer
upstream api {
     api_zone 64k;
    server api.internal:8080 resolve;
}

Press Ctrl⌘Enter to check your answer