question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Propagating Downstream Response Headers (set-cookie) to the Wundergraph Reponse

See original GitHub issue

Problem

Hi Wundergraph! Our downstream client uses cookie based authentication where, on a successful login mutation, they pass a set-cookie header in the response with the auth token. With this flow, we would need to pass this header upto the client but I’m not seeing anywhere to do this. With request headers it’s simple as we can specify to pass them in the introspect.graphql options but there’s no option for response headers. My other thought was to hook into the originResponse however I’m not sure how I can use this hook to mutate the final response. Can this be done?

Suggested solution

Similar to passing request headers in the graphql introspection, can we also add response headers in the same section? There’s complications to this due to a Wundergraph query potentially making multiple requests to the downstream api. We could add an enum with values of collate and overwrite so that the former would add all the values of the header in question to a comma-delimited string whilst the latter just chooses the last value set. Not too much thought has gone into the above though so there might be stumbling blocks.

Additional context

My downstream response headers:

Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: Opaque_token=aaa-bbbccc000ddd111eee222fff333-; Path=/; Domain=www.testdomain.com; Expires=Tue, 30-May-2023 13:14:20 GMT; Max-Age=15552000; Secure; HttpOnly
Strict-Transport-Security: max-age=31536000
Vary: Origin
Vary: Accept-Encoding
X-Content-Type-Options: nosniff

The response headers on the Wundergraph response:

HTTP/1.1 200 OK
Content-Type: application/json
Vary: Origin
Date: Thu, 01 Dec 2022 13:14:20 GMT
Content-Length: 119

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jensneusecommented, Dec 2, 2022

Let me know your thoughts on this one: https://github.com/wundergraph/wundergraph/discussions/389

0reactions
OLingardcommented, Dec 2, 2022

We’re not using Wundergraph authentication right now. You’re correct with the later point, authentication would solely be handled by the origin service. Wundergraph would just needs to pass on the set-cookie response header and the cookie request header (the latter is easily done).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · wundergraph/wundergraph - GitHub
Issues · wundergraph/wundergraph. ... wundergraph / wundergraph Public ... Propagating Downstream Response Headers (set-cookie) to the Wundergraph Reponse ...
Read more >
Configuring the propagation of HTTP headers and cookies for ...
Configuring the propagation of HTTP headers and cookies for a third-party ... Add the names of the headers and cookies that are to...
Read more >
Set-Cookie - HTTP - MDN Web Docs
The Set-Cookie HTTP response header is used to send a cookie from the server to the user agent, so that the user agent...
Read more >
Configure Headers for HTTP-based Data Sources
Dynamic headers allow you to set headers based on the client request. Configuration builder. The headers property is a fluent builder. Simply create...
Read more >
Set-Cookie on successful client response from External ...
1. Client sends a request to Istio gateway · 2. Gateway checks if the request is authenticated by forwarding the headers to external...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found