9951 explained code solutions for 126 technologies


nginx-luaGet user agent with Lua


server {
  location / {
    content_by_lua_block {
      ngx.say( ngx.var.http_user_agent);
    }
  }
}ctrl + c
content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.var

access request query string parameters

ngx.say

output given text to client

http_user_agent

returns user agent value