URL Maskinig Question

Continuing the discussion from URL Masking Question:

I have a client that wants me to forward their domain excelbroadcast.live to their partner’s web player portal at http://tv2.qqtv.us/. Simple enough, but my client also wants me to mask the URL so the destination URL will appear excelbroadcast.live rather than the URL of the web portal, tv2.qqtv.us.

I know this can’t be accomplished through page rules although I believe it can be accomplished through the use of Cloudflare workers.

I have done some light reading on the subject and came up with the following


addEventListener(“fetch”, event => {
let requestURI = new URL(event.request.url);

if (requestURI.hostname == “excelbroadcast.live” && requestURI.pathname.startsWith(“/”)) {
event.respondWith(rewriteURL(event.request));
}
})

async function rewriteURL(request) {
var URI = new URL(request.url);

URI.protocol = “http”;
URI.hostname = “tv2.qqtv.us”;

return fetch(URI, request);
}


It is directing excelbroadcast.live to tv2.qqtv.us; however, it is not masking the URL. I am entirely new to Cloudflare Workers, so I could be way off. I would greatly appreciate any guidance or advice anyone might have on the subject or on how to solve my issue.

Thank you

I too am looking for a solution for this.

1 Like

I haven’t had any luck yet but I know it’s possible.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.