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 and I need to access it with When I type in my browser, it works.
Visitors will find the app at the url, 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, it will return the request from
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]; = "account="+account; = "www example com";
      const newRequestInit = {
      const newRequest = new Request(
        new Request(request, newRequestInit)
      try {
        return await fetch(newRequest);
      } catch (e) {
        return new Response(JSON.stringify({ error: e.message }), {
          status: 500,