9951 explained code solutions for 126 technologies


nginx-luaAdd response header with Lua


server {
  location / {
    content_by_lua_block {
      ngx.header["X-Example"] = 'onelinerhub-example'
    }
  }
}ctrl + c
content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.header

allows to set response headers

X-Example

sample header to set

onelinerhub-example

sample value to set (online example)