From d62a96665b9bc61a37f86704a2db29b5fd86dad0 Mon Sep 17 00:00:00 2001 From: Joel Wurtz Date: Fri, 8 Jul 2022 15:50:08 +0200 Subject: [PATCH] fix(cloudflare): fix missing body when no filter --- worker/worker.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/worker/worker.js b/worker/worker.js index 60823fa..548ba33 100644 --- a/worker/worker.js +++ b/worker/worker.js @@ -58,7 +58,9 @@ function create_redirectionio_request(request, libredirectionio, clientIp) { redirectionioRequest.add_header(pair[0], pair[1]); } - redirectionioRequest.set_remote_ip(clientIp); + if (clientIp) { + redirectionioRequest.set_remote_ip(clientIp); + } return redirectionioRequest; } @@ -163,7 +165,7 @@ async function proxy(request, redirectionioRequest, action, options, libredirect // Skip body filtering if (bodyFilter.is_null()) { - return response; + return [response, response.status]; } const { readable, writable } = new TransformStream();