From 20a162e9152e8d9dc1427697e5a7899e8777ccdc Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Wed, 18 Jul 2018 15:07:40 +0200 Subject: [PATCH] Update nginx config --- support/nginx/cyclassist.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/support/nginx/cyclassist.conf b/support/nginx/cyclassist.conf index beff03e..5a51e4f 100644 --- a/support/nginx/cyclassist.conf +++ b/support/nginx/cyclassist.conf @@ -1,4 +1,6 @@ -# UWSGI proxy pass +# API rate limitation +limit_req_zone $binary_remote_addr zone=cycloAPI:10m rate=1r/s;# UWSGI proxy pass + upstream _cyclassist { server unix:/run/uwsgi/app/cyclassist/socket; } @@ -44,6 +46,7 @@ server { # Proxy pass the API calls to the server part location /api { + limit_req zone=cycloAPI burst=3 nodelay; include uwsgi_params; uwsgi_pass _cyclassist; }