How to add query params and render page according to that

I have created a static Html page which is a landing page and in the URL we are using utm parameters like utm_source utm_medium and other utm params and i when i am using the below code i am getting the else part

const html = `

render page

`; const notFound = `
<title>Page Not Found</title>

not found page

`;

async function handleRequest(request) {
if (
request.url ===
https://bewithrits.tech/employee-gps-tracking-digital-attendance-payroll-reports” ||
request.url ===
https://bewithrits.tech/employee-gps-tracking-digital-attendance-payroll-reports/” ||
request.url ===
https://bewithrits.tech/employee-gps-tracking-digital-attendance-payroll-reports.html” ||
request.url ===
https://bewithrits.tech/employee-gps-tracking-digital-attendance-payroll-reports?*”
) {
return new Response(html, {
headers: {
“content-type”: “text/html;charset=UTF-8”,
“Access-Control-Allow-Origin”: “https://bewithrits.tech”,
“Access-Control-Allow-Methods”: “OPTIONS, HEAD, POST, GET”,
“Access-Control-Allow-Headers”:
“X-Requested-With, Authorization,” + “Content-Type, Accept”,
},
});
} else {
return new Response(notFound, {
headers: {
“content-type”: “text/html;charset=UTF-8”,
“Access-Control-Allow-Origin”: “https://bewithrits.tech”,
“Access-Control-Allow-Methods”: “OPTIONS, HEAD, POST, GET”,
“Access-Control-Allow-Headers”:
“X-Requested-With, Authorization,” + “Content-Type, Accept”,
},
});
}
}

addEventListener(“fetch”, (event) => {
return event.respondWith(handleRequest(event.request));
});

This topic was automatically closed after 31 days. New replies are no longer allowed.