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

Can limit-req or limit-count use keys from headers like "authorization" or from query parameters like "teant" or whatever? #9193

Closed
13140983173 opened this issue Mar 29, 2023 · 5 comments

Comments

@13140983173
Copy link

Description

I found documentation that says only ["remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"] could be used as key, refers to https://apisix.apache.org/zh/docs/apisix/plugins/limit-req

Environment

  • APISIX version (run 2.15.0):
@tokers
Copy link
Contributor

tokers commented Mar 30, 2023

Set the key_type to vars and you can use the variables you want, for instance, if you want to use a HTTP header, use variable http_header_name, where header_name is the name of the HTTP header.

@13140983173
Copy link
Author

@tokers it works then,thx.

@fabrii
Copy link

fabrii commented Apr 10, 2023

Is this documented somewhere? I can see in https://apisix.apache.org/docs/apisix/plugins/limit-req/ that the valid values are ["var", "var_combination"]

@sdvdxl
Copy link

sdvdxl commented Oct 18, 2023

Set the key_type to vars and you can use the variables you want, for instance, if you want to use a HTTP header, use variable http_header_name, where header_name is the name of the HTTP header.

not vars but var_combination

@andresvargasr
Copy link

andresvargasr commented Sep 10, 2024

@tokers just want to say thanks it also worked for me using this conf: "key_type": "var" and "key": "$http_my_header_name" This save me a lot of time.

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

No branches or pull requests

5 participants