代理转发headers参数日志输出
背景
A:应用服务器,代码所放位置
B:代理服务器,nginx
C:第三方服务器
B和C服务器网络互通,A 和B 网络互通,A需要请求 C上面的接口,故通过 B来代理。
B 的nginx 配置
server {
listen 9019;
charset utf-8;
underscores_in_headers on;
location / {
proxy_set_header Host C服务器IP;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept $http_accept;
proxy_set_header Content-Type $http_content_type;
proxy_set_header X-Ca-Key $http_x_ca_key;
proxy_set_header X-Ca-Signature $http_x_ca_signature;
proxy_set_header X-Ca-Timestamp $http_x_ca_timestamp;
proxy_set_header X-Ca-Signature-Headers $http_x_ca_signature_headers;
proxy_next_upstream error timeout http_500 http_502 http_504;
proxy_send_timeout 15s;
proxy_connect_timeout 10;
proxy_read_timeout 60;
proxy_pass https://C服务器IP/$request_uri;
}
}
A 在请求B的时候,需要传参数在headers里面,所以在B的代理配置中设置了自定义参数,请教在B服务器上面 能看到 B请求C的headers参数是否传输正确吗?
因为我直接在B上面 curl C服务器是正常的,但是在A上面 curl B的代理 就返回不正常了。