So is "rewrite_by_lua" also evil?

Eugaia ngx.eugaia at
Sat Oct 15 10:25:43 UTC 2011

On 15/10/2011 12:57, Nginx User wrote:
> Any thoughts on Marcus' points earlier on clearing the ctx in the core?
> Seems to suggest that may cause problems elsewhere and that it is
> better to be handled at the module level.
> Seems logical as whether it was originally an oversight or not,
> changing it now would break other stuff.
I had a closer look at the code, and in fact clearing the contexts 
automatically won't break my code in particular because I don't use 
ngx_http_named_location() to find named locations (I find the location 
at conf-read time, not run time, since it's more efficient).  There may 
be other developers that use the function at runtime, but my guess is 
that it's probably not commonly used by module developers who would not 
prefer the contexts to be reset.

I would therefore agree with agentzh and Maxim about it probably being 
the best way to go, and should any developers create modules that 
currently call ngx_http_named_location() but don't want to clear the 
contexts, then they can just re-write the function to not do so.


More information about the nginx mailing list