diff --git a/github-filter/src/index.ts b/github-filter/src/index.ts index 57d7ca9..0545388 100644 --- a/github-filter/src/index.ts +++ b/github-filter/src/index.ts @@ -67,9 +67,17 @@ const worker = { return new Response("Make sure to specify webhook components like /:id/:token", { status: 400 }); } + const githubIp = request.headers.get("CF-Connecting-IP"); + + let headers = { ...request.headers }; + + if (githubIp) { + headers = { ...headers, "X-Forwarded-For": githubIp }; + } + const data: Data = { body: await request.text(), - headers: request.headers, + headers: headers, method: request.method, };