Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding proxy_set_header entries using an annotation #180

Closed
gregdaybreak opened this issue Jan 26, 2017 · 8 comments · Fixed by #246
Closed

adding proxy_set_header entries using an annotation #180

gregdaybreak opened this issue Jan 26, 2017 · 8 comments · Fixed by #246

Comments

@gregdaybreak
Copy link

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}"
@aledbf
Copy link
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?

@gregdaybreak
Copy link
Author

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

@aledbf
Copy link
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

@arjanschaaf
Copy link

@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?

@arjanschaaf
Copy link

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

@stibi
Copy link
Contributor

stibi commented Apr 24, 2017

arjanschaaf pushed a commit to arjanschaaf/ingress that referenced this issue Apr 24, 2017
…uration snippets was missing from the configuration documentation
@zheddiewen
Copy link

How can i add proxy_set_header X-Forwarded-Proto $scheme in nginx-ingress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants