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

[nginx] Add generated request id to headers #313

Closed
foxylion opened this issue Feb 21, 2017 · 9 comments · Fixed by #332
Closed

[nginx] Add generated request id to headers #313

foxylion opened this issue Feb 21, 2017 · 9 comments · Fixed by #332

Comments

@foxylion
Copy link
Contributor

To trace a request through all your services in ingress it would be good to add a Request-Id to request and response headers. This will allow tracking down all subsequent requests inside the cluster caused by one request from the outside.

We've already modified our nginx.tmpl but it would be great if this could be an (optional) default.

In case a default would be okay I can create a pull request (desired changes are here). For an optional default I would need some help to get the right place for adding the option to the ConfigMap. (I've never worked with Go yet.)

@foxylion foxylion changed the title [nginx] Add request id to headers [nginx] Add generated request id to headers Feb 21, 2017
@aledbf
Copy link
Member

aledbf commented Feb 21, 2017

@foxylion please check the custom-headers example

@aledbf
Copy link
Member

aledbf commented Feb 21, 2017

@foxylion requested to add newrelic headers #180

@foxylion
Copy link
Contributor Author

@aledbf Thank you, I didn't know that. But it will still leave the issue of setting also the response header (more_set_headers "Request-Id: $request_id";).

@aledbf
Copy link
Member

aledbf commented Feb 21, 2017

@foxylion I saw this nginx/kubernetes-ingress#117 and the idea of the snippets is more than interesting. With that you can add the missing more_set_headers and also the HSTS configuration. WDYT?

@foxylion
Copy link
Contributor Author

@aledbf Yes, this would solve this issue here completely.

But for the HSTS case (#314) the redirect configuration is still required and I'm unsure if this is not better something which should simply work more out of the box (the problem should be quite common on AWS).

@aledbf
Copy link
Member

aledbf commented Feb 21, 2017

@foxylion right. Let me add the snippets first and then we see what is needed for the HSTS header

@foxylion
Copy link
Contributor Author

@aledbf Ok, thanks. Then this one can be closed when nginx/kubernetes-ingress#117 is somehow merged. :)

@rchicoli
Copy link

This should be merged soon. Then you could freely add your own custom configmaps in different contexts like this:

metadata:
  annotations:
    nginx.org/location-snippets: |
       more_set_headers "Request-Id: $request_id";

Cheers.

@foxylion
Copy link
Contributor Author

@aledbf This looks good, I'll give it a try when it is released.

In the case of "request id" it would be good to have such an option in the ConfigMap so that I do not have to modify all ingress configurations. May this be an option?

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.

3 participants