Skip to content

HTTP出站代理是否可以指定Headers? #2172

Discussion options

You must be logged in to vote

這個簡單呀,改代碼,從新編譯

http.Header.Set("User-Agent", "I am a cat") 

或者等貢獻者增加自定義UA功能@RPRX

不用了,谢谢,我翻了翻源码,发现XRAY自带这个功能,只是文档里没有写

config.pb.go

配置改成这样

{
    "protocol": "http",
    "tag": "out-http-loopback",
    "settings": {
        "servers": [
            {
                "address": "127.0.0.1",
                "port": 61405,
                "users": [
                    {
                        "user": "FAKEVALUE",
                        "pass": "FAKEVALUE"
                    }
                ]
            }
        ],
        "headers": {
            "User-Agent": "Test"
        }
    }
}

不会报错,而且工作也正常

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@flowerinsnowdh
Comment options

Answer selected by flowerinsnowdh
@nursery01
Comment options

@chika0801
Comment options

Comment options

You must be logged in to vote
1 reply
@Murasame233
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants