提交 4bbf4cc9 作者: Steven Allen

gateway, api: canonicalize headers from user config

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 82629c00
......@@ -72,6 +72,7 @@ func addHeadersFromConfig(c *cmdsHttp.ServerConfig, nc *config.Config) {
// Copy these because the config is shared and this function is called
// in multiple places concurrently. Updating these in-place *is* racy.
for h, v := range nc.API.HTTPHeaders {
h = http.CanonicalHeaderKey(h)
switch h {
case cmdsHttp.ACAOrigin, cmdsHttp.ACAMethods, cmdsHttp.ACACredentials:
// these are handled by the CORs library.
......
......@@ -53,7 +53,7 @@ func GatewayOption(writable bool, paths ...string) ServeOption {
headers := make(map[string][]string, len(cfg.Gateway.HTTPHeaders))
for h, v := range cfg.Gateway.HTTPHeaders {
headers[h] = v
headers[http.CanonicalHeaderKey(h)] = v
}
// Hard-coded headers.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论