-
Notifications
You must be signed in to change notification settings - Fork 228
Description
Environment
- Proxyman Version: 6.3.0
- macOS Version: 26.2 (25C56)
- Script Type: Scripting Tool
Problem
When onRequest returns the request object (even without any modification to headers), Proxyman drops the Content-Encoding header from the actual HTTP request sent to the server.
Our server uses a custom Content-Encoding value (not gzip/deflate/br) to indicate a proprietary body encoding. After enabling Scripting, this header disappears.
Steps to Reproduce
- Create a Scripting rule matching any URL
- Use the following minimal script:
function onRequest(context, url, request) {
console.log("INPUT Content-Encoding:", request.headers["Content-Encoding"]);
request.customPreviewerTabs = { "Test": JSON.stringify({ ok: true }) };
console.log("OUTPUT Content-Encoding:", request.headers["Content-Encoding"]);
return request;
}- Send a request that originally contains
Content-Encoding: my_custom_value - Observe:
- Console shows both INPUT and OUTPUT have
Content-Encoding: my_custom_value - But the actual Request Headers in Proxyman UI (and sent to server) do NOT contain
Content-Encoding
- Console shows both INPUT and OUTPUT have
Expected Behavior
Returning request from onRequest should preserve all original headers, including Content-Encoding with custom values.
Actual Behavior
Content-Encoding header is dropped after onRequest returns, even though:
- It exists in
request.headerswhen received - It still exists in
request.headerswhen returned - The script does NOT modify
request.headers
Evidence (Console Log)
[REQ] INPUT headers: Host, Content-Type, Connection, Accept, Content-Encoding, ...
[REQ] INPUT Content-Encoding: my_custom_value
[REQ] OUTPUT headers: Host, Content-Type, Connection, Accept, Content-Encoding, ...
[REQ] OUTPUT Content-Encoding: my_custom_value
But the actual HTTP request sent to server has no Content-Encoding header.
Impact
Server cannot detect the custom encoding and returns parse error.
Workaround Attempted
- Copying headers with spread operator
{...request, headers: {...request.headers}}— same result - Explicitly re-setting
request.headers["Content-Encoding"] = originalValue— same result
None of these preserve the header in the actual outgoing request.