Skip to content

Commit

Permalink
Merge pull request #201 from python-discord/forward-github-ip-to-discord
Browse files Browse the repository at this point in the history
Forward github's IP to Discord upon sending webhooks
  • Loading branch information
shtlrs authored Dec 9, 2023
2 parents 30c3648 + 5b0c8e8 commit 9424f06
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion github-filter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down

0 comments on commit 9424f06

Please sign in to comment.