We use nginx to redirect any http request to https connection, So though the user makes http connection nginx will redirect to https connection.
Here does nginx have any limit that can handle only 'n' re-directions per second. Because our application is accessible by other system and they would make http requests always intentionally. So nginx has to redirect all the http requests to https, but It coulndn't handle many requests at a time.
But If we make https requests, It is able handle many number of requests per second as it doesn't require any redirection. Below is our configuration
server {
listen 6000; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name someDomain.com;
rewrite ^ https://$server_name$request_uri? ;
#root /usr/share/nginx/www;
index index.html index.htm;
}
Best Answer
You need to use the limit_req directive.
$binary_remote_addr
limits each IP to 25 requests per secondrate=25r/s
You can add
nodelay
tolimit_req
to make it respond with a 503 as soon as the limit is hit.