Skip to content

GM_xmlhttpRequest 不兼容,无法发送自定义的请求头 #20

@ViCrack

Description

@ViCrack

在scriptcat中使用如下代码指定headers

GM_xmlhttpRequest({
        method: 'GET',
        url: 'http://xxxx',
       headers:    {
            referer:  "http://microsoft.com",
            origin:   "http://microsoft.com"
       }

发现它会把Origin和Referer请求头变成

X-Cat-20379D59-3753-4Bc2-9Aac-7Fd1601C4454-Origin: http://microsoft.com
X-Cat-20379D59-3753-4Bc2-9Aac-7Fd1601C4454-Referer: http://microsoft.com

而且还莫名多了一个X-Cat-xxx-Scriptcat的出来
X-Cat-20379D59-3753-4Bc2-9Aac-7Fd1601C4454-Scriptcat: true

导致最终请求失败。

而我换成用tampermonkey去验证了一下,发送的请求头则都是标准和正确的值,也没有多余的X-Cat-xxx-Scriptcat出现。

这是为什么,需要如何避免?

Firefox最新版,后台脚本

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions