Bird
0
0

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📝 Best Practice Q15 of 15
Kubernetes - Ingress
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?
Anginx.ingress.kubernetes.io/custom-header: "X-Frame-Options=DENY"
Bnginx.ingress.kubernetes.io/add-headers: "X-Frame-Options: DENY"
Cnginx.ingress.kubernetes.io/headers: "X-Frame-Options: DENY"
Dnginx.ingress.kubernetes.io/configuration-snippet: "more_set_headers \"X-Frame-Options: DENY\";"
Step-by-Step Solution
Solution:
  1. 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.
  2. Step 2: Use the correct syntax for setting headers

    The directive more_set_headers "X-Frame-Options: DENY"; correctly adds the header.
  3. Final Answer:

    nginx.ingress.kubernetes.io/configuration-snippet: "more_set_headers \"X-Frame-Options: DENY\";" -> Option D
  4. Quick Check:

    Use configuration-snippet with more_set_headers for custom headers [OK]
Quick Trick: 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

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes