Nginx代理服务丢失请求头中带下划线_的参数

Nginx代理服务丢失请求头中带下划线_的参数

问题

    前几天对接了一个第三方的服务,第三方服务器有白名单ip限制,但是本地环境是没有固定ip的,所以在云服务器上(有固定ip)的nginx做了一个代理,但是调用接口发现总是提示请求投中的request_code参数找不到。

解决

在网上找了一些资料发现了这么一段话:

Syntax: underscores_in_headers on | off;
Default: underscores_in_headers off;
Context: http, server

Enables or disables the use of underscores in client request header fields. When
the use of underscores is disabled, request header fields whose names contain underscores
are marked as invalid and become subject to the ignore_invalid_headers directive.

大意就是:

nginx 默认是不支持下划线做为head中的参数,如果要使用则需要在http 或者server模块配置
underscores_in_headers on

在相关nginx添加这个配置,重新刷新nginx,问题解决。

你可能感兴趣的:(运维,运维,Cookie,Nginx)