How to add Noidexing to Ingress | add_header X-Robots-Tag "noindex, nofollow";

#1

I have staging websites and production website in same cluster, couldn’t able to figure out how to add Noindexing for staging websites.

add_header X-Robots-Tag "noindex, nofollow";

Kindly help me out.

#2

You can add this to the nginx-ingress controller globally by using server-snippet, for example:

apiVersion: v1
data:
  server-snippet: add_header X-Robots-Tag “noindex, nofollow”;

or you can add it to a specific ingress using nginx.ingress.kubernetes.io/server-snippet, for example:

nginx.ingress.kubernetes.io/server-snippet: |-
       add_header X-Robots-Tag "noindex, nofollow";