前端请求自定义header后端无法获取:
解决:改成首字母大写用 - 分割,例:Ap-Token: ****************
文档 RFC7504 明确指出Header的定义:
8.1.2. HTTP Header Fields HTTP header fields carry information as a series of key-value pairs. For a listing of registered HTTP headers, see the "Message Header Field" registry maintained at <https://www.iana.org/assignments/ message-headers>. Just as in HTTP/1.x, header field names are strings of ASCII characters that are compared in a case-insensitive fashion. However, header field names MUST be converted to lowercase prior to their encoding in HTTP/2. A request or response containing uppercase header field names MUST be treated as malformed (Section 8.1.2.6).
服务端 Nginx 开启了 HTTP/2,HTTP/2 和 HTTP/1.x 同样使用 ASCII 字符集,但 HTTP/2 头部必须使用小写,而不像 HTTP/1.x 大小写均可。