export default { async fetch(request) { const url = new URL(request.url); // Fetch the original page or asset from Vercel const targetUrl = "https://ar-sn-wedding-invitation.vercel.app" + url.pathname + url.search; const response = await fetch(targetUrl, { headers: { "User-Agent": request.headers.get("User-Agent") || "" } }); // Copy headers and remove iframe-blocking restrictions const newHeaders = new Headers(response.headers); newHeaders.delete("X-Frame-Options"); newHeaders.delete("Content-Security-Policy"); const contentType = newHeaders.get("content-type") || ""; if (contentType.includes("text/html")) { let html = await response.text(); // Inject CSS to hide the last image/footer logo cleanly const hideLogoCSS = ` `; html = html.replace("", hideLogoCSS + ""); return new Response(html, { status: response.status, headers: newHeaders }); } return new Response(response.body, { status: response.status, headers: newHeaders }); } };