无法从NGINX获取包含句点的标头 [英] Cannot get header that contains a period from NGINX

查看:109
本文介绍了无法从NGINX获取包含句点的标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于." .标头"Abp.TenantId" null .

如果删除." (如"AbpTenantId" ),就可以了.

If remove the "." (like "AbpTenantId"), it will be ok.

如何添加带有." 的标题?

How to add a header with a "."?

========================================================

=======================================================

localhost 调试:

  1. 显示了临时标题(应客户要求显示此标题)
  2. Request.Headers.Unknown(在服务器上通过api操作显示)
  3. Request.Headers.MaybeUnknown(在服务器上通过api操作显示)

localhost 没问题.

服务器中的代码相同,但服务器错误.

The same code in server, but server error.

tenantId 的代码:

日志没有 tenantId ,因此错误:

localhost 可以:

服务器失败:

推荐答案

Nginx作为反向代理不会传递包含句点的标头.

TenantIdResolveKey 是可配置的:

Configuration.MultiTenancy.TenantIdResolveKey = "Abp-TenantId";

低于ABP 4.4

您可以在Nginx中关闭忽略无效"标头:

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

控制是否应忽略名称无效的标题字段.有效名称由英文字母,数字,连字符和可能的下划线组成(由underscores_in_headers指令控制).

Controls whether header fields with invalid names should be ignored. Valid names are composed of English letters, digits, hyphens, and possibly underscores (as controlled by the underscores_in_headers directive).

如果指令是在服务器级别指定的,则仅当服务器是默认服务器时才使用它的值.指定的值还适用于在相同地址和端口上侦听的所有虚拟服务器.

If the directive is specified on the server level, its value is only used if a server is a default one. The value specified also applies to all virtual servers listening on the same address and port.

这篇关于无法从NGINX获取包含句点的标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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