Skip to content

Instantly share code, notes, and snippets.

View mbrother2's full-sized avatar
💪
Good luck!

rootorchild mbrother2

💪
Good luck!
View GitHub Profile
@mbrother2
mbrother2 / log-http-headers.md
Created September 20, 2024 04:06 — forked from kaichao/log-http-headers.md
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.." ";
[root@centos7 ansible]# cat ansible_check_owner.yml
---
- name: Test stat
connection: local
hosts: 127.0.0.1
tasks:
- name: Get stat of file
stat:
path: /root/a1.txt