adding proxy_set_header entries using an annotation #180

Closed
gregdaybreak opened this Issue Jan 26, 2017 · 6 comments

Comments

Projects
None yet
4 participants

gregdaybreak commented Jan 26, 2017

The proposal is to add support of adding a new proxy_set_header entry to the nginx config using an annotation.

For example I need to add

proxy_set_header X-Request-Start "t=${msec}”;

in order to report request queuing in New Relic.
from: https://docs.newrelic.com/docs/apm/applications-menu/features/request-queue-server-configuration-examples

Would be nice to be able to do this in an annotation like:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: testing
  namespace: testns
  annotations:
   ingress.kubernetes.io/proxy_set_header: "X-Request-Start "t=${msec}"
Member

aledbf commented Jan 26, 2017

@gregdaybreak I think the syntax "t=${msec}" is specific to nginx so maybe this should be in the configmap as global value instead of an annotation. Is that ok?

yeah I am really just trying to figure out the best way to add this. If it is through configmap that is fine with me. I was not sure what the best way to do it was so figured I would ask.

Would I just need to create a configmap like this:

apiVersion: v1
data:
  proxy_set_header X-Request-Start "t=${msec}”;
kind: ConfigMap
metadata:
  name: nginx-load-balancer-conf
Member

aledbf commented Feb 1, 2017

I think the global value of proxy-set-headers should point to a different ConfigMap to allow multiple values and avoid setting the same key multiple times.

Something like:

apiVersion: v1
data:
  proxy-set-headers: default/configmap-with-headers
kind: ConfigMap
metadata:
  name: nginx-load-balancer-conf
apiVersion: v1
data:
  X-Request-Start: "t=${msec}”
  X-Different-Name: "true"
  X-Using-Nginx-Controller: "true"
kind: ConfigMap
metadata:
  name: configmap-with-headers

@aledbf aledbf closed this in #246 Feb 16, 2017

Contributor

arjanschaaf commented Apr 21, 2017

@aledbf If I understand correctly it is currently only possible to add a global set of custom headers that is used by all Ingresses managed by the Ingress Controller? I was hoping that I would be able to assign a set of customer headers to a specific Ingress. For example security related headers such as Public-Key-Pins, X-Frame-Options & X-Content-Type-Options can be different for each deployment we run on our Kubernetes cluster. Would it be possible to add specific headers for an Ingress using annotations, overriding the globally set values if present in the ConfigMap configuration?

Contributor

arjanschaaf commented Apr 24, 2017

To answer my own question: custom headers per ingress can be done using configuration-snippets: https://github.com/kubernetes/ingress/tree/master/examples/customization/configuration-snippets/nginx

arjanschaaf added a commit to arjanschaaf/ingress that referenced this issue Apr 24, 2017

Mentioned in the comments of #180 the annotation for configuration sn…
…ippets was missing from the configuration documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment