0
0
Nginxdevops~10 mins

Adding response headers (add_header) 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 add a custom header named X-Custom-Header with value MyValue.

Nginx
add_header [1] MyValue;
Drag options to blanks, or click blank then click option'
AHeader-Value
BX-Header
CCustom-Header
DX-Custom-Header
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong or incomplete header name.
Forgetting to add the header name before the value.
2fill in blank
medium

Complete the code to add a header named Cache-Control with value no-cache.

Nginx
add_header [1] no-cache;
Drag options to blanks, or click blank then click option'
ANo-Cache
BCache
CCache-Control
DControl-Cache
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect header names like 'Cache' or 'No-Cache'.
Misspelling the header name.
3fill in blank
hard

Fix the error in the code to correctly add the header Strict-Transport-Security with value max-age=31536000.

Nginx
add_header [1] max-age=31536000;
Drag options to blanks, or click blank then click option'
AStrict-Transport-Security
BStrictTransportSecurity
CStrict_Transport_Security
DStrict Transport Security
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores or spaces instead of hyphens.
Omitting hyphens in the header name.
4fill in blank
hard

Fill both blanks to add a header named X-Frame-Options with value SAMEORIGIN.

Nginx
add_header [1] [2];
Drag options to blanks, or click blank then click option'
AX-Frame-Options
BSAMEORIGIN
CDENY
DALLOW-FROM
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect header names or values.
Mixing up the order of header name and value.
5fill in blank
hard

Fill all three blanks to add a header named Content-Security-Policy with value default-src 'self'; script-src 'none'.

Nginx
add_header [1] "[2] [3]";
Drag options to blanks, or click blank then click option'
AContent-Security-Policy
Bdefault-src
C'self'; script-src 'none';
Dscript-src
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the header value.
Using incomplete or incorrect directives.
Misplacing semicolons or quotes.