Nginx 日志中打印 POST 请求体
Nginx About 656 words$request_body
The variable’s value is made available in locations processed by the proxy_pass, fastcgi_pass, uwsgi_pass, and scgi_pass directives when the request body was read to a memory buffer.
配置
在log_format
中配置$request_body
,并且在access_log
中引用。
http {
log_format upstream_pattern '$remote_addr [$time_local] [$request_time] [$upstream_response_time] "$request" $status $body_bytes_sent $request_body';
server {
listen 8080;
location /api {
access_log /tmp/nginx/access.log upstream_pattern;
proxy_pass http://localhost:9090;
}
}
}
文档
Views: 113 · Posted: 2025-01-06
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...