Chromium Client Hints:如何在Delegate-CH元标签中设置多个URL?
客户端提示头Delegate-CH的正确配置方案
1. 多URL的正确写法
你当前的Delegate-CH元标签格式有误,导致example2.com无法获取完整的客户端提示头。正确的格式规则是:
- 每个客户端提示头名称后,用空格分隔多个授权URL
- 不同提示头的配置项之间,用分号+空格分隔
修正后的代码如下:
<meta http-equiv="Accept-CH" content="Sec-CH-UA, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Model, Sec-CH-UA-Mobile, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version"> <meta http-equiv="Delegate-CH" content="Sec-CH-UA https://example1.com https://example2.com; Sec-CH-UA-Full-Version-List https://example1.com https://example2.com; Sec-CH-UA-Model https://example1.com https://example2.com; Sec-CH-UA-Mobile https://example1.com https://example2.com; Sec-CH-UA-Platform https://example1.com https://example2.com; Sec-CH-UA-Platform-Version https://example1.com https://example2.com">
你之前的写法错误地在每个提示头的第二个URL前加了分号,浏览器无法识别这种格式,导致example2.com未被正确授权。
2. 多Delegate-CH元标签的标准性
你提到的“设置第二个元标签对应第二个URL”的写法是符合标准的。HTTP规范允许页面存在多个同类型的http-equiv="Delegate-CH"元标签,浏览器会自动合并所有元标签中的授权规则,最终实现每个提示头被授权给多个URL的效果。
比如这种写法是完全合规的:
<meta http-equiv="Delegate-CH" content="Sec-CH-UA https://example1.com; Sec-CH-UA-Full-Version-List https://example1.com; Sec-CH-UA-Model https://example1.com; Sec-CH-UA-Mobile https://example1.com; Sec-CH-UA-Platform https://example1.com; Sec-CH-UA-Platform-Version https://example1.com"> <meta http-equiv="Delegate-CH" content="Sec-CH-UA https://example2.com; Sec-CH-UA-Full-Version-List https://example2.com; Sec-CH-UA-Model https://example2.com; Sec-CH-UA-Mobile https://example2.com; Sec-CH-UA-Platform https://example2.com; Sec-CH-UA-Platform-Version https://example2.com">
3. 额外检查点
- 确认example2.com的跨域请求确实触发了客户端提示头携带:只有当页面向example2.com发起资源请求时,浏览器才会根据授权规则在请求头中加入对应的Sec-CH-*字段。
- 保持所有URL使用HTTPS:客户端提示头的委托机制仅支持HTTPS环境,你的测试页面已经满足这一点。
内容的提问来源于stack exchange,提问作者Stiegi
相关产品推荐
相关产品推荐

