Update worker.js

Remove origin IP from header
This commit is contained in:
Trần Kim Tín (Trust) authored and GitHub committed 2025-08-04 11:51:06 +07:00
1 parent 4aaa3a2bd6
commit e632009118
1 file changed
+6
+6
View File
@@ -36,6 +36,12 @@ async function handleRequest(request) {
try {
const method = request.method;
const headers = new Headers(request.headers);
headers.delete("Cf-Connecting-Ip");
headers.delete("x-forwarded-for");
headers.delete("x-real-ip");
headers.delete("forwarded");
headers.delete("cdn-loop");
const contentType = headers.get("Content-Type");
if (contentType && contentType.startsWith("application/json") && !contentType.includes("charset")) {
headers.set("Content-Type", "application/json; charset=UTF-8");