I need add response header "X-Robots-Tag: noindex, nofollow". Ingress controller contains directive more_set_headers "X-Robots-Tag: noindex, nofollow";
. But in response I don't see it.
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.global-static-ip-name: development-ip
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_headers "X-Robots-Tag: noindex, nofollow";
name: front-ingress
namespace: staging
spec:
rules:
- host: somedomain
http:
paths:
- backend:
serviceName: front-service
servicePort: 80
path: /*
- backend:
serviceName: backend-service
servicePort: 80
path: /api/*
tls:
- hosts:
- somedomain
secretName: front-tls-secret
The problem: cluster have 2 ingress controllers nginx/gce. Annotations was applied to nginx ingress controller, but traffic was via gce ingress controller.
If I understand you correctly you can try to use server-snippet
:
apiVersion: v1
data:
server-snippet: add_header X-Robots-Tag “noindex, nofollow”;
for a snippet in the nginx config service block.
Or you can add it to a specific ingress using nginx.ingress.kubernetes.io/server-snippet
:
nginx.ingress.kubernetes.io/server-snippet: |-
add_header X-Robots-Tag "noindex, nofollow";
for a snippet in the nginx config service block.
Please let me know if that helped.