-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lua code in header_filter phase still runs after ngx.exit(401) is executed in access phase #2279
Comments
I think what the documentation says with regard to your question is
Literally interpreted, if you call
Test it and you will see that content_by_lua_file(request handling) is not executed, but both header filter and log phases are still working! |
If you're right, does that mean the document is wrong? My colleague told me that the old version of lua-nginx-module would return directly, but I don't have the old binary installation package to test:) |
ngx.exit(>=200) will exit the current phase and enter into the |
I saw in the documentation that using ngx.exit(<200) would make the request return directly to the client without executing the lua code at various stages later, and my colleague told me that was correct, my colleague had previously used an older version of openrest (seems to be 1.19.X)
But I tested linux version 1.21.4.3 and windows version 1.25.3.1 and found that even if I executed ngx.exit(401) during the access phase, it still triggered lua script during the header_filter phase. Why? Did I use it wrong?
my nginx config
test/access.lua
test/header.lua
result (logs/error.log)
The text was updated successfully, but these errors were encountered: