From 1b4babb98d21b68ce2e5eb1b6b10dc6163775f4d Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Sun, 14 Jan 2024 09:59:43 +0000 Subject: [PATCH] docs(readme): replace `fastify.io` links with `fastify.dev` (#358) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce9a99de..70270b49 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ In case a client reaches the maximum number of allowed requests, an error will b message: 'Rate limit exceeded, retry in 1 minute' } ``` -You can change the response by providing a callback to `errorResponseBuilder` or setting a [custom error handler](https://www.fastify.io/docs/latest/Reference/Server/#seterrorhandler): +You can change the response by providing a callback to `errorResponseBuilder` or setting a [custom error handler](https://fastify.dev/docs/latest/Reference/Server/#seterrorhandler): ```js fastify.setErrorHandler(function (error, request, reply) { @@ -151,7 +151,7 @@ await fastify.register(import('@fastify/rate-limit'), { - `continueExceeding`: Renew user limitation when user sends a request to the server when still limited - `store`: a custom store to track requests and rates which allows you to use your own storage mechanism (using an RDBMS, MongoDB, etc.) as well as further customizing the logic used in calculating the rate limits. A simple example is provided below as well as a more detailed example using Knex.js can be found in the [`example/`](https://github.com/fastify/fastify-rate-limit/tree/master/example) folder - `skipOnError`: if `true` it will skip errors generated by the storage (e.g. redis not reachable). -- `keyGenerator`: a sync or async function to generate a unique identifier for each incoming request. Defaults to `(request) => request.ip`, the IP is resolved by fastify using `request.connection.remoteAddress` or `request.headers['x-forwarded-for']` if [trustProxy](https://www.fastify.io/docs/latest/Reference/Server/#trustproxy) option is enabled. Use it if you want to override this behavior +- `keyGenerator`: a sync or async function to generate a unique identifier for each incoming request. Defaults to `(request) => request.ip`, the IP is resolved by fastify using `request.connection.remoteAddress` or `request.headers['x-forwarded-for']` if [trustProxy](https://fastify.dev/docs/latest/Reference/Server/#trustproxy) option is enabled. Use it if you want to override this behavior - `errorResponseBuilder`: a function to generate a custom response object. Defaults to `(request, context) => ({statusCode: 429, error: 'Too Many Requests', message: ``Rate limit exceeded, retry in ${context.after}``})` - `addHeadersOnExceeding`: define which headers should be added in the response when the limit is not reached. Defaults all the headers will be shown - `addHeaders`: define which headers should be added in the response when the limit is reached. Defaults all the headers will be shown