Hi, This is an example of an entry in the log, left by HttpLimitReqModule: 2013/10/27 10:00:11 1402#0: *313355 limiting requests, excess: 0.580 by zone "zone1", client: 20.147.43.103, server: api.acme.com, request: "GET /location/locate-ip?key=xxxx&ip=85.210.42.204 HTTP/1.1", host: "api.acme.com" What does "excess: 0.580" mean exactly? What isby Brian08275660 - Nginx Mailing List - English
Hi Francis, Probably I shouldn't have said "malformed" when I chose a word to express the problem with the response. But I assumed that Nginx should show the phrase that corresponds to the code. I assumed that Nginx has been coded so it know that 429 means "Too Many Requests" and that we should receive that string instead of the generic -and not very useful- string "Ngiby Brian08275660 - Nginx Mailing List - English
This is the output: root@ip-10-139-33-71:~# curl -v <URL was here > * About to connect() to api.xxxxxxxxxxxxxx.com port 80 (#0) * Trying 40.57.235.104... connected > GET /location/locate-ip?key=BBANBWEDS7UZ6FD8747F76VZ&ip=201.1.1.1 HTTP/1.1 > User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3 > Host: api.xxxxby Brian08275660 - Nginx Mailing List - English
Hi Francis, I think I'm actually reporting a malformed response, it is Nginx that send "nginx/1.4.3" instead of something useful as "too many requests". I have tested it with Firefox and there is no doubt. Also tested it with a java HTTP client component, the same result. The status code received is correct (429), but not the message that comes with it. I had just discoveby Brian08275660 - Nginx Mailing List - English
Hi, I'm doing this: limit_req_status 429; The module HttpLimitReqModule delivers "nginx/1.4.3" (at least with version 1.4.3) as a message for the HTTP status code 429. That is too generic and not useful at all. Why doesn't it deliver a "Too Many Requests" message instead of that? It is absurd, useless. Not only that, but the HTML response that comes with an HTTP 503 sby Brian08275660 - Nginx Mailing List - English
Oh, ok. Then it is similar to REGEX in Java. Well, then I think I have a nice and elegant solution, Thanks!by Brian08275660 - Nginx Mailing List - English
I read some information about REGEX and think I found the way to express "X or x, preceded with something before": ~*(.*)X I think that the first two characters mean "match anycase", then the "(.*)" would mean "any quantity of characters" and the "X" would mean that specific letter. Am I right?by Brian08275660 - Nginx Mailing List - English
Hi Payam, I dont have that option. My users are not using real browsers, but objects that model an HTTP client. Probably these object can't inject cookies. And I don't want to ask them to so so, it would make things more complex to them, whereas including an extra parameter in the query string is a piece of cake. Thanks anyway for the idea!by Brian08275660 - Nginx Mailing List - English
Hi Jader, Thanks a lot, that looks like a nice solution! I barely know how to build regex expressions, and I'm too lazy to learn just right now. Just a final question: Actually they will send me any value from 2X to 25X, but that could even increase to more than 25. I would like a simpler and more open REGEX, something like: If it is something that includes an "X" I will useby Brian08275660 - Nginx Mailing List - English
Hi Francis, Now I need to create a limit that acts if the parameter ("capacity") is empty (not provided). How do I do that? I can't find how to, at least not using "map". (If provided, the other rules will evaluate it and one of them will act according to the value). Thanks in advanced!by Brian08275660 - Nginx Mailing List - English
Hi Francis, Thanks a lot! You saved me probably a couple of days of research. It is working now! I did this: The user will send my a "capacity" parameter, with a value of 2X or 3X or 4X or......(etc) map $arg_capacity $2X_key{~*2X $http_x_forwarded_for;default "";} map $arg_capacity $3X_key{~*3X $http_x_forwarded_for;default "";} map $arg_capacity $4Xby Brian08275660 - Nginx Mailing List - English
Thanks a lot Francis! Now I just have to learn how to use the custom variables and the "map" directive. I haven't ever used them before, never needed them. By the way, it will be easier than what I thought. I decided to ask my users to add an extra parameter, something like "&capacity=3X" instead of "hiding" some characters in the key that would indicate what toby Brian08275660 - Nginx Mailing List - English
Could you please give me an example? A few lines of code would be great!by Brian08275660 - Nginx Mailing List - English
Hi, I'm using the limit_req_zone module. I would like it to act only on some requests that have a certain string in one variable in the query string of the URL.For example, lets say that I'm providing a IP geolocation service, and that in the URL there is a query string like this: http://api.acme.com/ipgeolocation/locate?key=NANDSBFHGWHWN2X&ip=146.105.11.59 I would like the rule to deby Brian08275660 - Nginx Mailing List - English