-
Notifications
You must be signed in to change notification settings - Fork 105
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
Router - Forward generated Request-Id to subgraph #534
Comments
WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible. |
I have something working on my computer, I'm just lacking time to make tests for the moment. Moreover, can you tell me where I can add tests for this ? I've started modifying the router.go file in core package with this: (start at line 776) httpRouter.Use(middleware.RequestID)
// Rewrite request id in request header to allow "simple" forward to subgraph
httpRouter.Use(func(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Get request id
reqID := middleware.GetReqID(r.Context())
// Save it in request header
// Note: if it wasn't generated by middleware, it will override with the same value
// Note: so nothing important is made in this case
r.Header.Set(middleware.RequestIDHeader, reqID)
// Next
h.ServeHTTP(w, r)
})
}) |
I think being able to write my own func newHTTPTransport(opts *SubgraphTransportOptions) http.RoundTripper { with its own I need this for writing my own transportation metrics, among other things As I understand the authors intended that https://cosmo-docs.wundergraph.com/router/custom-modules could be used to solve your problem. |
…to subgraph Related to issue wundergraph#534
@flymedllva : Yes custom modules can help for this but I proposed this because I can imagine multiple people wanted the same thing. If this is rejected by maintainers, that won't a problem for me, I will try to do it only via custom modules. |
…to subgraph Related to issue wundergraph#534
…to subgraph Related to issue wundergraph#534
Component(s)
router
Is your feature request related to a problem? Please describe.
As an operation team member, I would like to forward the generated request-id (generated by chi middleware if request doesn't have it) to subgraph.
Describe the solution you'd like
In configuration and using the "Header manipulation" feature, I would like to be able to forward X-Request-Id (even if it is generated by router backend) to subgraph backends.
Something like this:
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: