export default {
async fetch(request) {
const url = new URL(request.url);
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") || "Mozilla/5.0" }
});
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();
// Hides the last logo/footer and adds your custom bottom banner
const customInjection = `
`;
html = html.replace("", customInjection + "");
return new Response(html, { status: response.status, headers: newHeaders });
}
return new Response(response.body, { status: response.status, headers: newHeaders });
}
};