Skip to content

Instantly share code, notes, and snippets.

View AronllStone's full-sized avatar
🏠
Working from home

Konstantin Apanchyonok AronllStone

🏠
Working from home
  • Minsk, Belarus
View GitHub Profile
@kaichao
kaichao / log-http-headers.md
Last active July 16, 2024 16:11
nginx: Log complete request/response with all headers

1. switch nginx image to openresty/openresty

2. add the following to server/location (/etc/nginx/conf.d/default.conf)

   set $req_header "";
   set $resp_header "";
   header_filter_by_lua_block{ 
      local h = ngx.req.get_headers();
      for k, v in pairs(h) do
         ngx.var.req_header = ngx.var.req_header .. k.."="..v.." ";