preserve ws-headers for vmess in Surge (#49)

This commit is contained in:
Matthew Wo 2021-09-03 16:41:07 +08:00 committed by GitHub
parent 47b7ac6267
commit 204e5b73a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -2598,9 +2598,10 @@ var ProxyUtils = (function () {
}`; }`;
if (proxy.network === "ws") { if (proxy.network === "ws") {
const path = proxy["ws-path"] || "/"; const path = proxy["ws-path"] || "/";
const host = proxy["ws-headers"].Host; const wsHeaders = Object.entries(proxy["ws-headers"]).map(
config += `,ws=true${path ? ",ws-path=" + path : ""}${host ? ",ws-headers=HOST:" + host : "" ([key, value]) => (`${key}:"${value}"`))
}`; .join('|');
config += `,ws=true${path ? ",ws-path=" + path : ""}${wsHeaders ? ",ws-headers=" + wsHeaders : ""}`;
} }
if (proxy.tls) { if (proxy.tls) {
config += `${typeof proxy["skip-cert-verify"] !== "undefined" config += `${typeof proxy["skip-cert-verify"] !== "undefined"

File diff suppressed because one or more lines are too long