Reverse Proxy is not working

So i’m kinda new to this.

I have a domain registered on Cloudflare and connected to a Webflow project.
This is all working fine, CF handles the SSL.

What I want to accomplish is creating a reverse proxy that will send traffic from



So far I have come up with the following code and added this to a worker, but when visiting my site, it doesn’t change the url when testing.

addEventListener('fetch', event => {

async function handleRequest(request) {
  let url = new URL(request.url)
  if (url.pathname.startsWith('/projects/')) {
    url.pathname = '/projects/test' + url.pathname.substr(10)
  return fetch(url)

This code won’t change the URL in the browser, but rather fetch from products/agri/* and return it.