Skip to content

bactoria/nginx-limit-req-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

limit req test

How to Use

1. run server

cd server
npm install
npm run start

 

 

 

2. run Nginx

download Nginx

http://nginx.org/en/download.html

 

replace nginx.conf (with this repo)

nginx-1.16.1/conf/nginx.conf (windows10)

 

nginx detail

# ...

http {
    # ...

    limit_req_zone $binary_remote_addr zone=testZone:10m rate=10r/s;

    server {
        listen       80;
        server_name  localhost;

        location / {
            proxy_pass http://localhost:4000;
            # ...
        }

        location /recommend {
            proxy_pass http://localhost:4000/recommend;
            # ...
            
            limit_req zone=testZone burst=5;
            limit_req_status        429;
            limit_req_log_level     error;
        }

        # ...

    }

}

   

run Nginx

 

 

3. Test

 

click Button

- Browser log

- Server log