limit_req is not working in virutal location?

Maxim Dounin mdounin at
Thu Jan 11 15:57:09 UTC 2018


On Thu, Jan 11, 2018 at 10:47:29AM -0500, pva wrote:

> Francis, thank you for you answer.
> > On Thu, Jan 11, 2018 at 03:32:07AM -0500, pva wrote:
> > I'm slightly guessing, so apologies if I mislead you and hopefully
> > someone else will correct this if necessary...
> > 
> > > Hi. Could you, please, explain why limit_req in @limitspeed location
> > > is not working in case of redirect to @allowed virtual location and
> works
> > > in case I copy @allowed virtual location contents inside @limitspeed? 
> > 
> > I think that "return" happens before, and therefore effectively
> > overrides "limit_req".
> This is my guess as well. But then I'm wondering if this limit will be
> applied in case try_files redirects to @localdvr?
> try_files /live$uri @localdvr; 

That's because try_files is not a mechanism to "conditionally select 
configurations"[1] like the rewrite module directives (including 
"return"), but rather a way to choose which file will be used for 
request processing.  As such, try_files checks happen right before 
actually returning the response, after various access checks and 


Maxim Dounin

More information about the nginx mailing list