如何在 nginx 中记录所有标头? [英] How to log all headers in nginx?

查看:30
本文介绍了如何在 nginx 中记录所有标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何记录客户端(浏览器)在 Nginx 中发送的所有标头?我还想记录响应标头.请注意,我使用 nginx 作为反向代理.

How do I log all the headers the client (browser) has sent in Nginx? I also want to log the response headers. Note that I am using nginx as reverse proxy.

阅读文档后,我知道我可以记录特定的标头,但我想记录所有标头.

After going through documentation, I understand that I can log a specific header, but I want to log all of the headers.

推荐答案

经过大量研究后,我得出的结论是,开箱即用是不可能的.

After much research, I can conclude that it is not possible out of the box.

更新——你可以使用 Lua 自带的 openresty.使用 Lua 可以做一些很酷的事情,包括记录所有的标头,比如 Redis 或其他一些服务器

Update- you can use openresty which comes with Lua. Using Lua one can do pretty cool things, including logging all of the headers to say, Redis or some other server

这篇关于如何在 nginx 中记录所有标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆