2808 explained code solutions for 75 technologies


nginx-luaHow to send plain text response


server {
  location / {
    content_by_lua_block {
      ngx.header["Content-type"] = 'text/plain'
      ngx.say('hi')
    }
  }
}ctrl + c
content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.header

allows to set response headers

text/plain

set content type to text/plain

ngx.say

output given text to client