Setting the status code
rkearsley at blueyonder.co.uk
Tue Aug 6 11:31:10 UTC 2013
On 06/08/13 04:02, Dennis Jacobfeuerborn wrote:
> Since I determine the reason for the denied access in lua a way to do
> it there would also help. I already tried "nginx.status = 403"
> followed by a "nginx.exec('/reason1')" but while the right page is
> display the status code returned gets reset to 200.
You can do it in lua.. you need to do it in the header filter stage
I'm doing something similar but probably not exactly the same
Hopefully example helps (untested):
set $status_code "";
-- your lua script here etc...
-- if (an error happened) then
ngx.var.status_code = "403"
if ngx.var.status_code ~= "" then
ngx.status = ngx.var.status_code
More information about the nginx