-
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
Not able to use Nginx's error_page in conjunction with *_by_lua_block #875
Comments
https://groups.google.com/forum/#!searchin/openresty-en/error_page|sort:relevance/openresty-en/1XASYFeP61o/W93sexzXTNkJ seems similar, but I am not using any |
@giorgiosironi Are you sure there exists a |
To be precise, I added that file; its content is just:
|
@giorgiosironi Try building your openresty temporarily with the |
This is the log, after starting nginx and executing |
@giorgiosironi Okay, I see what's going on here. To solve your problem, you should replace location /forbidden_lua {
content_by_lua_block {
ngx.status = 403
ngx.say("Forbidden from a lua block")
return ngx.exit(403)
}
} with location /forbidden_lua {
content_by_lua_block {
return ngx.exit(403)
}
} The reason is that for |
Ok, got it. For the record, I was trying to setup an |
@giorgiosironi did you find a workaround way to do it with Kong ? |
Hey, guys, you should really report it to Kong instead. Already off topic. |
I am using the following Nginx configuration:
with the version:
From what I understood
ngx.exit
stop further Lua blocks from being evaluated and returns the result to Nginx. So I would expect Nginx'serror_page
to let me intercept the 403 being returned by Lua code, and show my4xx.html
file, but it doesn't:The text was updated successfully, but these errors were encountered: