无法从 NGINX 获取包含句点的 header
Cannot get header that contains a period from NGINX
header "Abp.TenantId"
是 null
因为 "."
.
如果删除"."
(如"AbpTenantId"
),就可以了。
如何用"."
添加header?
============================================= ==========
localhost
调试:
- 已显示临时 header(应客户要求显示)
- Request.Headers.Unknown(在服务器中显示,api 操作)
- Request.Headers.MaybeUnknown(在服务器中显示,api 操作)
localhost
可以。
服务器中的代码相同,但服务器错误。
tenantId
的代码:
日志没有 tenantId
,所以错误:
localhost
可以:
服务器失败:
Nginx as a reverse proxy will not pass headers that contain a period.
ABP 4.4+
TenantIdResolveKey
可配置:
Configuration.MultiTenancy.TenantIdResolveKey = "Abp-TenantId";
ABP 4.4 以下
你可以在 Nginx 中关闭 ignore "invalid" headers:
Syntax: ignore_invalid_headers on | off;
Default: ignore_invalid_headers on;
Context: http, server
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.
header "Abp.TenantId"
是 null
因为 "."
.
如果删除"."
(如"AbpTenantId"
),就可以了。
如何用"."
添加header?
============================================= ==========
localhost
调试:
- 已显示临时 header(应客户要求显示)
- Request.Headers.Unknown(在服务器中显示,api 操作)
- Request.Headers.MaybeUnknown(在服务器中显示,api 操作)
localhost
可以。
服务器中的代码相同,但服务器错误。
tenantId
的代码:
日志没有 tenantId
,所以错误:
localhost
可以:
服务器失败:
Nginx as a reverse proxy will not pass headers that contain a period.
ABP 4.4+
TenantIdResolveKey
可配置:
Configuration.MultiTenancy.TenantIdResolveKey = "Abp-TenantId";
ABP 4.4 以下
你可以在 Nginx 中关闭 ignore "invalid" headers:
Syntax: ignore_invalid_headers on | off; Default: ignore_invalid_headers on; Context: http, server
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.