URL Masking with wildcard

Hi CF community,

I am trying to perform URL masking for a subdomain. This is the code I have tweaked for CF workers:

addEventListener(‘fetch’, function (event) {
async function handleRequest(request) {
// Only GET requests work with this proxy.
if (request.method !== ‘GET’) return MethodNotAllowed(request);
return fetch(target subdomain);
function MethodNotAllowed(request) {
return new Response(Method ${request.method} not allowed., {
status: 405,
headers: {
Allow: ‘GET’,

The only issue is that I can’t get the URL mask to maintain itself when the web user clicks through different webpages on the site. Does anyone know if a similar code can be run that will account for different webpages on the original site (ie. include a wildcard code to maintain the mask)?

Thanks in advance for your help.

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