ClashX.Meta icon indicating copy to clipboard operation
ClashX.Meta copied to clipboard

[Feature] 添加/更新 托管配置文件 添加 User-Agent (自定义请求头)

Open ousui opened this issue 3 months ago • 0 comments

环境 Environment

  • 使用者的操作系统 (the OS running on the client) macos 15.7.1 (24G231)
  • 网路环境或拓扑 (network conditions/topology) Wifi
  • iptables,如果适用 (if applicable) 无
  • ISP 有没有进行 DNS 污染 (is your ISP performing DNS pollution?) 无
  • 其他

说明 Description

目前在用的一个机场对订阅链接的请求做了限制,需要特定的 User-Agent (经测试 手机版正常User-Agent: ClashMetaForAndroid/2.5.12.Meta )才可以拉取到,ClashX.Meta 默认 UA 无效。

需要添加一个自定义UA的功能,方便使用。

补充curl

添加 ua 后

> OPTIONS /Moe233-Subs/qwbm/api/v1/client/subscribe?token=xxxxxx HTTP/2
> Host: moes.lnaspiring.com
> Accept: */*
> User-Agent: ClashMetaForAndroid/2.5.12.Meta
>
* Request completely sent off
< HTTP/2 200
< server: nginx
< date: Fri, 07 Nov 2025 07:31:44 GMT
< content-type: text/html; charset=UTF-8
< allow: GET,HEAD
< cache-control: no-cache, private
< access-control-allow-origin: *
< age: 2
< via: http/1.1 sv07-tky02-jp (ApacheTrafficServer-second [uSc sSf pSeN:tMc  p sS]), http/1.1 sv06-tky02-jp (ApacheTrafficServer-first [uSc sSf pSeN:tMc  pSs ])
< x-webaccel-origin-status: 200
< vary: Access-Control-Request-Method
<
* Connection #0 to host moes.lnaspiring.com left intact
* 

添加ua 前

> OPTIONS /Moe233-Subs/qwbm/api/v1/client/subscribe?token=xxxxxx HTTP/2
> Host: moes.lnaspiring.com
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/2 502
< server: nginx
< date: Fri, 07 Nov 2025 07:31:54 GMT
< content-type: text/html
< content-length: 157
< age: 0
< via: http/1.1 sv07-tky02-jp (ApacheTrafficServer-second [uSc s f p eN:tMc  p sS]), http/1.1 sv19-tky02-jp (ApacheTrafficServer-first [uSc s f p eN:tMc  pSs ])
< x-webaccel-origin-status: 502
<
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.28.0</center>
</body>
</html>
* Connection #0 to host moes.lnaspiring.com left intact

ousui avatar Nov 07 '25 07:11 ousui