无法从NGINX获取包含句点的标头 [英] Cannot get header that contains a period from NGINX
问题描述
由于."
.标头"Abp.TenantId"
为 null
.
如果删除."
(如"AbpTenantId"
),就可以了.
If remove the "."
(like "AbpTenantId"
), it will be ok.
如何添加带有."
的标题?
How to add a header with a "."
?
========================================================
=======================================================
localhost
调试:
- 显示了临时标题(应客户要求显示此标题)
- Request.Headers.Unknown(在服务器上通过api操作显示)
- Request.Headers.MaybeUnknown(在服务器上通过api操作显示)
localhost
没问题.
服务器中的代码相同,但服务器错误.
The same code in server, but server error.
tenantId
的代码:
日志没有 tenantId
,因此错误:
localhost
可以:
服务器失败:
推荐答案
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屋!