Nginx Lua Quick Reference


  1. To create a variable in Lua that can be accessed in Nginx: ngx.var.target can be accessed as $target in Nginx config.
  2. To send to error log: ngx.log(ngx.ERR, err).
  3. To get request header: ngx.req.get_headers()["Authorization"].
  4. To exit with a status: return ngx.exit(401).
  5. To access the request URI path component: ngx.var.uri.
  6. To get the request URI host component: ngx.var.host.
Posted on April 11, 2019 12:41 PM by Subhash Chandran
nginx lua openresty