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: Add a header if exist not overwrite #6710

Closed
purekeeper opened this issue Mar 24, 2022 · 7 comments
Closed

help request: Add a header if exist not overwrite #6710

purekeeper opened this issue Mar 24, 2022 · 7 comments

Comments

@purekeeper
Copy link

purekeeper commented Mar 24, 2022

Description

How can i add a header if not exist ,don't overwite if exist. Which plugin should used, proxy-rewite is not suitable,beacause it will overwrite if exist

Environment

  • APISIX version (run apisix version):
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):
@purekeeper purekeeper changed the title help request: Add a header if not exist not overwrite help request: Add a header if exist not overwrite Mar 24, 2022
@soulbird
Copy link
Contributor

Maybe, we can add a configuration to determine if headers needs to be rewritten

@tokers
Copy link
Contributor

tokers commented Mar 25, 2022

@purekeeper Currently, you may support this by the serverless plugin: https://apisix.apache.org/docs/apisix/plugins/serverless.

@kwanhur
Copy link
Contributor

kwanhur commented Mar 25, 2022

  • If the header was on request, proxy-rewrite plugin is a better choice.
  • If it's on response, response-rewrite plugin is a better choice.

But both them have no support .

Support to set header if nonexistent, they'll easier to reach intention than serverless plugin.

@tzssangglass
Copy link
Member

Another compromise is to use the vars on the route to distinguish between routes with a specified header and those without one, and to handle them separately.

IMO, don't override if it exists: this will cause to check the all headers, which is inefficient.

@PGDream
Copy link

PGDream commented Apr 26, 2022

suggest request add、remove、replace header plugin.

@github-actions
Copy link

This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 11, 2023
@soulbird
Copy link
Contributor

solved in #8336

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants