5. You want to customize your Ingress to add a custom header X-Frame-Options: DENY for security. Which annotation and value should you add to achieve this with nginx ingress controller?
hard
A. nginx.ingress.kubernetes.io/custom-header: "X-Frame-Options=DENY"
B. nginx.ingress.kubernetes.io/add-headers: "X-Frame-Options: DENY"
C. nginx.ingress.kubernetes.io/headers: "X-Frame-Options: DENY"
D. nginx.ingress.kubernetes.io/configuration-snippet: "more_set_headers \"X-Frame-Options: DENY\";"
Solution
Step 1: Identify how to add custom headers in nginx ingress
The nginx ingress controller supports adding custom headers via the configuration-snippet annotation using nginx directives.
Step 2: Use the correct syntax for setting headers
The directive more_set_headers "X-Frame-Options: DENY"; correctly adds the header.
Final Answer:
nginx.ingress.kubernetes.io/configuration-snippet: "more_set_headers \"X-Frame-Options: DENY\";" -> Option D
Quick Check:
Use configuration-snippet with more_set_headers for custom headers [OK]
Hint: Use configuration-snippet with nginx directive for custom headers [OK]
Common Mistakes:
Using non-existent annotation keys
Incorrect syntax for header setting
Confusing add-headers with configuration-snippet
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.