diff --git a/lib/fetch.js b/lib/fetch.js index a429cfc6f..d17cce1cb 100644 --- a/lib/fetch.js +++ b/lib/fetch.js @@ -44,7 +44,8 @@ export function skipLoggingFetchError(error) { || error?.code === 'ERR_STREAM_PREMATURE_CLOSE' || error?.code === 'ERR_HTTP2_STREAM_ERROR' || error?.code === 'ERR_HTTP2_SESSION_ERROR' - || error?.code === 'Z_DATA_ERROR'; + || error?.code === 'Z_DATA_ERROR' + || error?.code === 'Z_BUF_ERROR'; } function doFetch(fetch_func, h1_fetch_func, options) { diff --git a/lib/utils.js b/lib/utils.js index 361a7aa78..1a7589643 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -116,6 +116,16 @@ export function prepareRequestOptions(request_options, options) { } request_options.headers = request_options.headers || {}; + + const forward_sig = options?.getProviderOptions && options.getProviderOptions('app.http_forward_sig'); + + // Put forward headers. + const forward_headers = options?.getProviderOptions && options.getProviderOptions('app.http_forward_headers'); + if (forward_headers && typeof forward_headers === 'object' && !Array.isArray(forward_headers)) { + for (const [key, value] of Object.entries(forward_headers)) { + request_options.headers[key] = value; + } + } if (CONFIG.PROXY || options?.proxy) { @@ -195,7 +205,7 @@ export function prepareRequestOptions(request_options, options) { setCookieFromJar(uri, request_options.headers, options?.jar) - if ((options?.sig || request_sig) && options?.getSigHeaders) { + if (!forward_sig && (options?.sig || request_sig) && options?.getSigHeaders) { try { options.getSigHeaders(original_uri, function(error, headers) { if (error) {