feat: add rate limiting

This commit is contained in:
Elias Schneider
2022-10-24 12:11:10 +02:00
parent c2b87aba5c
commit 712cfe625a
7 changed files with 109 additions and 8 deletions

View File

@@ -8,9 +8,11 @@ export const config = {
},
};
// This function can be marked `async` if using `await` inside
export default (req: NextApiRequest, res: NextApiResponse) =>
httpProxyMiddleware(req, res, {
// You can use the `http-proxy` option
export default (req: NextApiRequest, res: NextApiResponse) => {
return httpProxyMiddleware(req, res, {
headers: {
"X-Forwarded-For": req.socket.remoteAddress ?? "",
},
target: "http://localhost:8080",
});
};