RESOLVED: Can't enable workers

Hello community,

Could you please assist to enable the worker?

I added (saved and deployed) a new worker with a simple code:

addEventListener("fetch", event => {

event.respondWith(handleRequest(event.request))

})

/**

* Fetch and log a request

* @param {Request} request

*/

async function handleRequest(request) {

return new Response("Hello worker!", { status: 200 })

}

I also created a new route for this worker pointing to a subfolder on the website (site.com is not the actual website and is used for description only):
.site.com/folder1/

When I visit the URL https://site.com/folder1/ I expect the page to return Hello worker! no matter what the server responds. But I get the actual response from the server instead.

This is a test sample I can’t make to work, although the final task is to add a custom header through worker.

Thank you!

siteDOTcom is not on Cloudflare.

This is a sample description, I explained what I’ve done, the link to actual website won’t help here as the URL is not accessible for general public (needs to be admin logged in).

EDIT: No, the actual URL will actually help here, but I would like to keep the website private.

Is there any special action required to be done for the worker to start working (additionally to creating a route and assigning worker to it)?

I figured out the error.

The route I defined was with asteriks and dot at the beginning, which means all subdomains of the main domain, so after removing the dot at the beginning, all works fine.