Worker fetch doesn't seem to take query URL into account

My web application is waiting for a query URL to work properly when it first loads. It’s located at www.myapp.com and I need to access it with www.myapp.com?query=example. When I type www.myapp.com?query=example in my browser, it works.
Visitors will find the app at the url example.myapp.com, this domain will be proxyd by cloudflare and sent to a worker. The worker’s job is to change the host and generate the query string:
If a request comes from example.myapp.com, it will return the request from www.myapp.com?query=example.
I can see in the worker console that the request is modified correctly, but the result displayed is such that the “?query=example” is missing. I’ve been pulling my hair out over this for 2 days to no avail.

Any idea what I’m missing?

The worker code :

export default {
  async fetch(request) {
    
    const urlPath = request.url;
    
      const url = new URL(request.url);
      let query = urlPath.replace('https://','').split(".")[0];
      url.search = "account="+account;
      url.host = "www example com";
      console.log(url.toString());
      const newRequestInit = {
      };
      const newRequest = new Request(
        url.toString(),
        new Request(request, newRequestInit)
      );
      try {
        return await fetch(newRequest);
      } catch (e) {
        return new Response(JSON.stringify({ error: e.message }), {
          status: 500,
        });
      }
  },
};