Skip to content

[Feature Request] Allow custom HTTP headers on subscription download (e.g. x-hwid) #5213

Description

@oskinyuri

Verify Steps

  • Tracker 我已经在 Issue Tracker 中找过我要提出的问题
  • Latest 我已经使用最新 Dev 版本查看过,并不包含该功能特性或者还不完善
  • Relevant 我知道 OpenClash 与 内核(Core)、控制面板(Dashboard)、在线订阅转换(Subconverter)等项目之间无直接关系,仅相互调用
  • Definite 这确实是 OpenClash 应包含的特性
  • Contributors 我有能力协助 OpenClash 开发或完善此功能特性
  • Meaningless 我提交的是无意义的催促更新或修复请求

Describe the Feature

Problem

Some panels require a custom request header when fetching the subscription. For example,
Remnawave's "HWID Device Limit" needs an x-hwid header — without it the panel returns a
placeholder config ("App not supported" node) instead of the real nodes, so Config Subscribe
can't be used against such a panel.

OpenClash lets me set a custom User-Agent (sub_ua), but there is no way to add arbitrary
request headers.

Where

luci-app-openclash/root/usr/share/openclash/openclash_curl.shDOWNLOAD_FILE_CURL()
hardcodes the request headers. Only these are ever sent:

  curl ... -H "User-Agent: ${DOWNLOAD_UA}" \
           -H "X-Age-Public-Key: ${SECRET_KEY}" \
           -H "$ETAG_HEADER" "$DOWNLOAD_URL" -o ...

There is no hook to add e.g. x-hwid.

Request

An optional per-subscription "Custom headers" field (free-form Name: value lines) that
DOWNLOAD_FILE_CURL forwards to curl via -H. That is enough to send x-hwid (plus optional
x-device-os / x-device-model / ...), which makes OpenClash work with HWID-limited
subscriptions.

Note: mihomo already supports a header field on proxy-providers / rule-providers; this
request only adds the same capability to the config/subscription fetch itself.

Describe Alternatives

Current workaround: a cron job that curls the subscription with the required header and writes
the result to the config file, instead of using OpenClash's own Config Subscribe. This works but
it's clearly something the client should be able to do natively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions