9951 explained code solutions for 126 technologies


nginx-luaHow to return 403 Forbidden status code


server {
  location / {
    content_by_lua_block {
      ngx.say('no')
      ngx.exit(ngx.HTTP_FORBIDDEN)
    }
  }
}ctrl + c
content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.say

output given text to client

ngx.exit

end response with specified status code

ngx.HTTP_FORBIDDEN

HTTP code 403, see list of available codes