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

docs: improve limit-req plugin docs #11873

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kayx23
Copy link
Member

@kayx23 kayx23 commented Dec 30, 2024

Description

Improve limit-req plugin docs.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. doc Documentation things labels Dec 30, 2024
```

For authenticated requests:
Create `key-auth` Credential for the consumer:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Create `key-auth` Credential for the consumer:
Create `key-auth` Credential for the Consumer:

```

You can set a custom rejected message by configuring the `rejected_msg` attribute. You will then receive a response like:
Create `key-auth` Credential for the consumer:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Create `key-auth` Credential for the consumer:
Create `key-auth` Credential for the Consumer:

```

Similarly for removing the Plugin from a Consumer:
Send two requests simultaneously, each for one consumer:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Send two requests simultaneously, each for one consumer:
Send two requests simultaneously, each for one Consumer:

```

You should receive `HTTP/1.1 200 OK` for both requests, indicating the request has not exceeded the threshold for each consumer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You should receive `HTTP/1.1 200 OK` for both requests, indicating the request has not exceeded the threshold for each consumer.
You should receive `HTTP/1.1 200 OK` for both requests, indicating the request has not exceeded the threshold for each Consumer.

## Delete Plugin

To remove the `limit-req` Plugin, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.
Create a Route with `key-auth` and `limit-req` plugins, and specify in the `limit-req` Plugin to use a combination of variables as the rate limiting key:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Create a Route with `key-auth` and `limit-req` plugins, and specify in the `limit-req` Plugin to use a combination of variables as the rate limiting key:
Create a Route with `key-auth` and `limit-req` Plugins, and specify in the `limit-req` Plugin to use a combination of variables as the rate-limiting key:

You can also configure the Plugin on specific consumers to limit their requests.

First, you can create a Consumer and enable the `limit-req` Plugin on it:
Generate three requests to the route:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Generate three requests to the route:
Generate three requests to the Route:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Documentation things size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants