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

help request: How to get the context (ctx) or request headers inside the ResponseFilter of a Go plugin? #12078

Open
BainDragneel opened this issue Mar 21, 2025 · 5 comments
Labels
question label for questions asked by users

Comments

@BainDragneel
Copy link

Description

I need to add some information to the response header, and the added information depends on values from the request header. I’m considering using context to pass data, but I couldn’t find a function to get the ctx.

Environment

  • APISIX version (run apisix version): v3.11
@dosubot dosubot bot added the question label for questions asked by users label Mar 21, 2025
@Baoyuantop
Copy link
Contributor

Are you using apisix-go-plugin-runner?

@BainDragneel
Copy link
Author

YES,The plugin is written in Go and is injected into the conf of the ext-plugin-post-resp plugin.

Are you using apisix-go-plugin-runner?

@BainDragneel
Copy link
Author

@Baoyuantop Please take another look at this issue.

@Baoyuantop
Copy link
Contributor

Baoyuantop commented Mar 24, 2025

You can refer to this document https://apisix.apache.org/docs/go-plugin-runner/getting-started/
In addition, this plugin for APISIX provides a similar capability.

@BainDragneel
Copy link
Author

BainDragneel commented Mar 24, 2025

@Baoyuantop The values I need to add depend on the request endpoint and certain request headers. For example, whitelisted endpoints don’t require this header to be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question label for questions asked by users
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants