I have Nginx in front of apache to terminate SSL and filter things. I'm trying to get rate limiting working using these docs.
When I test a loop of 10 requests with curl, all the requests for /mytest/ are still being forwarded back to Apache - 8 of them show the same timestamp down to the second. I'm expecting only one request/second should reach Apache. What have I overlooked?
My curl command:
for i in $(seq 1 10); do curl --verbose --request "GET /mytest" https://myhost.com; done
nginx.conf:
http {
...
include /etc/nginx/conf.d/*.conf;
...
}
/etc/nginx/conf.d/rate-limit.conf:
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
server {
location /mytest/ {
limit_req zone=one; #:: removed burst=5 for testing - made no diff
}
}
Your location with rate limit is
/mytest/
but you are requesting/mytest
(without a trailing slash). These requests won't match that location.