mirror of
https://github.com/masterking32/MasterHttpRelayVPN.git
synced 2026-05-17 21:24:37 +03:00
feat: strip accept-encoding header to ensure uncompressed responses in relay
This commit is contained in:
@@ -26,6 +26,10 @@ const SKIP_HEADERS = {
|
||||
"x-forwarded-port": 1, "x-real-ip": 1, "forwarded": 1, "via": 1,
|
||||
// Internal relay hop-count header — must not be forwarded to target sites.
|
||||
"x-mhr-hop": 1,
|
||||
// UrlFetchApp does not decompress gzip/br/deflate responses — stripping
|
||||
// accept-encoding forces targets to reply with plain (uncompressed) bodies
|
||||
// so the relay never has to handle compressed content it cannot decode.
|
||||
"accept-encoding": 1,
|
||||
};
|
||||
|
||||
// Pattern that matches any Google Apps Script execution endpoint.
|
||||
|
||||
@@ -19,6 +19,9 @@ const STRIP_HEADERS = new Set([
|
||||
"via",
|
||||
// Internal relay hop header — must not propagate to the final target.
|
||||
"x-mhr-hop",
|
||||
// Workers cannot decompress gzip/br/deflate — stripping accept-encoding
|
||||
// forces targets to reply with plain bodies the Worker can forward as-is.
|
||||
"accept-encoding",
|
||||
]);
|
||||
|
||||
function decodeBase64ToBytes(input) {
|
||||
|
||||
@@ -77,6 +77,9 @@ _STRIP_HEADERS = frozenset(
|
||||
"x-real-ip",
|
||||
"forwarded",
|
||||
"via",
|
||||
# urllib.request cannot decompress gzip/br/deflate — stripping this
|
||||
# forces targets to reply with plain bodies the server can forward.
|
||||
"accept-encoding",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user