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

requestID middleware should entertain X-Request-ID along with Request-ID #170

Closed
chinmayb opened this issue Jun 21, 2019 · 4 comments
Closed
Assignees

Comments

@chinmayb
Copy link
Contributor

chinmayb commented Jun 21, 2019

Currently NGINX controller accepts X-Request-ID and auto generates an ID . Internal components who use requestID middleware looks for Request-ID. So the nginx requestID gets lost and new requestID gets propagated.

Proposals

  • make changes in nginx to accept Request-ID header
    or
  • Modify the middleware to accept just X-Request-ID or both.
@Evgeniy-L Evgeniy-L self-assigned this Jul 8, 2019
@kd7lxl
Copy link
Contributor

kd7lxl commented Jul 10, 2019

It will be easier to modify the nginx config to accept Request-ID. I am working on a PR for this.

@Evgeniy-L
Copy link
Contributor

@chinmayb, @kd7lxl, this was investigated previously and there is a document on how to populate Request Id At Nginx level.

request-id middleware works on gRPC level and tries to extract Request-Id from gRPC metadata. See:
https://github.com/infobloxopen/atlas-app-toolkit/blob/master/requestid/requestid.go#L37
https://github.com/infobloxopen/atlas-app-toolkit/blob/master/gateway/header.go#L15

Headers that come from REST need to be translated to gRPC metadata. This is done by DefaultHeaderMatcher. The problem here is that headers like Request-ID or X-Request-ID are not translated by default. Headers translation can solved like this.

Following the Request Id At Nginx level doc we will be able to populate Grpc-Metadata-Request-Id header which will be translated to Request-ID into gRPC metadata by DefaultHeaderMatcher. This way we will not need any changes for existing services. In a similar way we will be able to add other headers at Nginx level if needed.

@drewwells
Copy link
Contributor

drewwells commented Jul 31, 2019

Request-ID is not a standard or commonly used HTTP header. Toolkit should support the very common header X-Request-ID. This ID is not just for nginx, it's used by many proxies and middleware logging applications to trace requests through server stacks. We do not want to modify every possible middleware to support our non-standard Header which most likely will break future applications when a Request-ID standard is defined.

We should deprecate, but continue to support Request-ID while adding support and updating documentation for X-Request-ID. At the next major release, we can remove support for Request-ID.

https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Common_non-standard_response_fields

@Calebjh
Copy link
Contributor

Calebjh commented Jul 21, 2022

Fixed in #197

@Calebjh Calebjh closed this as completed Jul 21, 2022
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

No branches or pull requests

5 participants