Hello!
On Fri, Feb 6, 2015 at 9:23 PM, Robert Paprocki wrote:
> I've noticed that the code run in the access_by_lua directive seems to run
> twice when I request 'http://example.com/', I'm assuming because there's an
> internal rewrite to /index.html.
This is the expected behavior with nginx internal redirects. When
internal redirects happen, access phase handlers (and rewrite phase
handlers and etc) always run again. Not just access_by_lua, but also
access-phase handlers registered by any other nginx C modules.
Well, we could expose a simple Lua API based on the "r->uri_changes"
field on the C land so that the Lua programmers can explicitly check
whether it is the first run or not. Patches welcome :)
Regards,
-agentzh