Skip to content

settings.json 中 extraHeaders 不再生效,导致 CF-Access 场景客户端离线 #786

@ryzonic

Description

@ryzonic

问题描述

在使用 Cloudflare Access 保护 HAPI Hub 时,客户端需要携带 CF-Access 相关 headers。

之前版本需要在 settings.json 中配置 extraHeaders 才可以正常连接,但当前版本中 settings.json 里的 extraHeaders 似乎不再生效,导致客户端无法连接 Hub,机器显示离线。

已确认

源码中看起来:

  • configuration.tsextraHeaders / CF-Access headers 只从环境变量 HAPI_EXTRA_HEADERS_JSON 读取
  • tokenInit.ts 初始化时只从 settings.json 读取了 cliApiToken
  • _setExtraHeaders 没有业务代码调用
  • settings.json 中的 extraHeaders 字段没有被读取

实际结果

即使在 settings.json 中配置了 extraHeaders,客户端请求仍未携带 CF-Access headers,导致机器离线。

期望结果

如果旧版本支持/依赖在 settings.json 中配置 extraHeaders,当前版本也应该继续兼容读取该配置。

或者文档中明确说明该配置已迁移为只支持环境变量 HAPI_EXTRA_HEADERS_JSON,并提供迁移说明。

备注

这看起来像是一个 regression:旧版本可用的 settings.json.extraHeaders 配置在当前版本中不再生效。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions