小编Joh*_*han的帖子

在 Nginx 中排除特定的查询参数?

我想知道是否可以将 URI 中的特定查询参数排除在记录到 Nginx 访问日志之外?

这是我们当前的配置:

log_format  main  '$remote_addr - $remote_user [$time_local] $host "$request" '
                      '$status $body_bytes_sent $request_time "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
Run Code Online (Sandbox Code Playgroud)

无论请求路径如何,假设我希望从记录中排除“纬度”参数(或者最好应该对其进行混淆)。我知道我可以通过将“$request”更改为例如“$request_method $uri”来排除所有查询参数,但随后我丢失了所有不是我想要的参数。

更新:

我想GET /index.html?latitude=43.4321&otherkey=value HTTP/1.1被混淆到这样的事情:GET /index.html?latitude=******&otherkey=value HTTP/1.1

nginx

4
推荐指数
1
解决办法
287
查看次数

标签 统计

nginx ×1