繁体   English   中英

如何在 uWSGI 中以 logformat 添加 HTTP_FORWARDED

[英]How to add HTTP_FORWARDED in logformat in uWSGI

我指的是-https://uwsgi-docs.readthedocs.io/en/latest/LogFormat.html

默认日志格式为:

[pid: %(pid)|app: -|req: -/-] %(addr) (%(user)) {%(vars) vars in %(pktsize) bytes} [%(ctime)] %(method) %(uri) => generated %(rsize) bytes in %(msecs) msecs (%(proto) %(status)) %(headers) headers in %(hsize) bytes (%(switches) switches on core %(core))

%(addr)REMOTE_ADDR

我的应用程序位于一个反向代理后面。 所以我需要HTTP_FORWARDED来获取客户端的真实 IP 地址。

我可以看到配置用户定义的 logvars的选项,但不确定是否可以通过Falcon实现。

将选项--log-x-forwarded-for添加到 uwsgi 命令,或者,
site.ini为:

log-x-forwarded-for = true

如果您使用的是配置文件。

请参阅 uwsgi 选项中的详细信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM