Nginx - 访问 Http 自定义标头 [英] Nginx - Access Http custom headers

查看:89
本文介绍了Nginx - 访问 Http 自定义标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的要求.我有一个 nginx web 服务器和一个 netscaler 代理.从 netscaler,选项 Client_IP header 被选中,header 的名称是 HTTP_CLIENT_IP.

I have a simple requirement. I have a nginx web server and a netscaler proxy. From netscaler, the option Client_IP header is checked, and name of header is HTTP_CLIENT_IP.

我想在nginx日志中访问这个ip.我已指定自定义日志格式,因此我可以访问此值:

I want to access this ip in nginx log. I have specified a custom log format, so i can access this value:

我在日志格式中尝试了以下变量,它们只是以-"形式返回.

I have tried the following variables in the log format, and they just return in '-'.

$http_client_ip
$http_request_body

基本上,我想读取 nginx 从 netscaler 接收到的整个请求标头/正文.

Basically, i want to read the entire request header / body that nginx receives from netscaler.

任何帮助将不胜感激!

推荐答案

Netscaler 插入带有客户端 IP 的 http 标头(如果已启用).但是,您必须在 netscaler 上配置 http 标头名称.

Netscaler inserts a http header with the client ip, if enabled. However You have to configure the http header name on the netscaler.

这篇关于Nginx - 访问 Http 自定义标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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