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

Header request insert from context #1317

Open
rasmusviben opened this issue Oct 28, 2024 · 3 comments
Open

Header request insert from context #1317

rasmusviben opened this issue Oct 28, 2024 · 3 comments
Labels
enhancement New feature or request internally-reviewed The issue has been reviewed internally.

Comments

@rasmusviben
Copy link

Component(s)

router

Is your feature request related to a problem? Please describe.

Currently its not possible to insert headers from context in the router, like we see on Apollo. It requires a custom module, but would be great to have this feature in the pure config file.

Describe the solution you'd like

Etc reading user_id from context in config.yaml

version: '1'
headers:
  all: # Rules for all origin requests
    request:
      - insert:
          name: "User-ID"
          from_context: "user_id"

Describe alternatives you've considered

Create a custom plugin/module that supports to read from context and insert the header.

Additional context

No response

@rasmusviben rasmusviben added the enhancement New feature or request label Oct 28, 2024
Copy link

WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible.
The roadmap is driven by our customers and we have to prioritize issues that are important to them.
You can influence the priority by becoming a customer. Please contact us here.

@StarpTech StarpTech added the internally-reviewed The issue has been reviewed internally. label Oct 29, 2024
@StarpTech
Copy link
Contributor

Hi @rasmusviben, thanks for opening an issue. Could you elaborate a bit more on your needs? Do you only want to forward UserID? Thanks.

@rasmusviben
Copy link
Author

rasmusviben commented Oct 29, 2024

No, its just an example. I have a bunch of headers - 6-7 values that I would like to read from the context and forward as header, like for apollo: https://www.apollographql.com/docs/graphos/routing/header-propagation - see section "Insert header from context". Might be against rules to link to Apollo from here, but I'll take my chances. :)

Currently I can't see thats possible to do with the cosmo-router without writing a custom module?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request internally-reviewed The issue has been reviewed internally.
Projects
None yet
Development

No branches or pull requests

2 participants