Convert Page Rules To Workers

How to Convert page rules to workers

Also want to get rid of fbclid from all URLs using Cloudflare workers I tried this

addEventListener(‘fetch’, event => {
let url = new URL(event.request.url)

if (url.searchParams.has(‘fbclid’))
url.searchParams.delete(‘fbclid’)

event.respondWith(
fetch(url, event.request)
)
})

and it’s not working

What is that supposed to mean? These two are very different and not comparable. Of course you can still implement a lot of page rule logic via a Worker (not all) but that will simply be manually writing JavaScript code.

Not exactly a precise description either. The code you posted does remove the fbclid parameter from the URL.