Welcome! Log In Create A New Profile

Advanced

limit_req at server level gives 404 error for files rewritten at location level?

J.R.
April 26, 2020 11:00AM
I skimmed over the ngx_http_limit_req_module.c and didn't see anything
obvious in relation to file checking, but here's my scenario...

I have a location block that will re-write the requested 'versioned'
file name to the actual common file name, so I can set some things
immutable without having to deal with changing tons of physical files
(only the HTML changes).

example (shortened for brevity):

# file.v1.gif = file.gif
location ~* (.+)\.v\d+\.(gif|jpg|png)$ {
try_files $1.$2 $uri @proxy;
}

When I had the following limit_req in my @proxy 'location' block,
limiting worked fine.

location @proxy {
limit_req zone=reqlimit burst=24 delay=12;
proxy_pass http://backend;
}

Obviously the above limit_req never interacted with the rewriting
'location' mentioned above (the @proxy at the end of try_files was
just a fallback in case of errors).

However, when I moved the limit_req up to the 'server' level, I
started getting 404 errors for all the image requests that were
handled by the above mentioned rewriting location block. All other
files were handled just fine.

Kind of scratching my head on this one. Any thoughts Maxim?

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

limit_req at server level gives 404 error for files rewritten at location level?

J.R. April 26, 2020 11:00AM

Re: limit_req at server level gives 404 error for files rewritten at location level?

Maxim Dounin April 26, 2020 12:44PM

Re: limit_req at server level gives 404 error for files rewritten at location level?

J.R. April 26, 2020 02:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 213
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