Return JSON responses when using OpenResty + Lua

Related posts I've written few related post that may be interesting have a look to first: Returning status code with OpenResty + Lua When ngx.exit using »

Returning status code with OpenResty + Lua

If we want to return specific status codes from our Lua code we should have the following in mind: ngx.say("hello") return ngx.exit(404) »

When ngx.exit using OpenResty precede it with return

It is recommended than when using ngx.exit precede it with return to reinforce the fact that request will end. Few notes from Yichun Zhang about »