Welcome! Log In Create A New Profile

Advanced

Limit request + whitelist = not using response code from backend? 0.8.54

DreamWerx
February 19, 2013 08:06AM
Hi all,

I'm hoping someone can help me with a small issue. I'm trying to
implement rate limiting with a whitelist, and all in all it seems to
be working, but
the wrong response code is being sent back to the browser.

For example if the apache backend sends a 302 redirect response, nginx
still sends a 200 back? If I remove the mapping to code 200, it then
sends a 418 back.
Is there an easy fix for this?

Here is my config. Thanks for any help.

---------

http {
recursive_error_pages on;
proxy_buffering off;

geo $limited {
default 1;
10.0.0.0/8 0;
xxx.xxx.xxx.xx 0;
}

limit_req_zone $binary_remote_addr zone=protect1:10m rate=5r/s;
}


location / {
error_page 418 =200 @limitclient;
#error_page 418 @limitclient;
if ($limited) {
return 418;
}

proxy_read_timeout 300;
default_type text/html;
charset utf-8;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_pass http://backend;
}

location @limitclient {
error_page 503 @flooder;
limit_req zone=protect1 burst=5 nodelay;

proxy_read_timeout 300;
default_type text/html;
charset utf-8;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_pass http://backend;
}

location @flooder {
rewrite ^(.*)$ /flooder.html break;
}

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Limit request + whitelist = not using response code from backend? 0.8.54

DreamWerx February 19, 2013 08:06AM

Re: Limit request + whitelist = not using response code from backend? 0.8.54

Maxim Dounin February 19, 2013 08:20AM

Re: Limit request + whitelist = not using response code from backend? 0.8.54

Anonymous User February 19, 2013 08:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 324
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready