【问题标题】:How to add HTTP header in uwsgi logs如何在 uwsgi 日志中添加 HTTP 标头
【发布时间】:2018-04-04 14:49:05
【问题描述】:

我有一个 nginx 作为代理,uWSGI 作为应用服务器。我想将任何 http 标头添加到 uwsgi 日志中。我可以在日志中添加一些var.VAR_NAME

通过文档 (http://uwsgi-docs.readthedocs.io/en/latest/LogFormat.html):

%(var.XXX) -> 请求变量 XXX 的内容(如 var.PATH_INFO,可从 1.9.21)

但这仅适用于来自 nginx 的 uwsgi_param,不适用于 proxy_set_header 或 smt。像这样。

【问题讨论】:

    标签: nginx logging http-headers uwsgi


    【解决方案1】:

    我在 uwsgi github 问题 - https://github.com/unbit/uwsgi/issues/1407#issuecomment-326605267 中找到了答案并更新了文档 (http://uwsgi-docs.readthedocs.io/en/latest/LogFormat.html):

    %(var.XXX) -> 请求变量 XXX 的内容(如 var.PATH_INFO 或 var.HTTP_X_MY_HEADER 用于请求的标头,可从 1.9.21)

    【讨论】:

      猜你喜欢
      • 2018-07-03
      • 1970-01-01
      • 2016-01-30
      • 2012-08-28
      • 2019-05-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-23
      相关资源
      最近更新 更多