Routing with React.js

I am a new Cloudflare user and now I am trying to host my React application in Workers.

The problem is that I use react-router it interacts with url and render content. For it to work, I need that almost all requests were sent to index.html

In nginx, this worked using try_files $ uri /index.html;
React application example: (github: the-road-to-learn-react/react-router-dynamic-routes-example, sorry I can only 2 links)

Question: How to implement this with cloudflare tools?

As a solution, I found the Portzilla application. But it makes me explicitly specify all the files and folders that need to be proxied and I do not want to have an application dependency

I have this setup using a proxy that I wrote: https://www.npmjs.com/package/cloudworker-proxy

In this case I have all the static files hosted on gitlab using their CI-system. The api is running on google cloud functions and the total setup costs me 0$/month.

You can setup rules to handle both mapping to static assets and to the index file:

[{
    "host": "www.example.com",
    "path": "/static/:file*",
    "handlerName": "loadbalancer",
    "options": {
      "sources": [
        {
          "url": "https://org.gitlab.io/sample-app/static/{file}"
        }
      ]
    }
  },
  {
    "host": "www.example.com",
    "handlerName": "loadbalancer",
    "options": {
      "sources": [
        {
          "url": "https://org.gitlab.io/sample-app/index.html"
        }
      ]
    }
  },
  {
    "handlerName": "loadbalancer",
    "host": "api.example.com",
    "path": "/:file*",
    "options": {
      "sources": [
        {
          "url": "https://xxx.cloudfunctions.net/your-api/{file}"
        }
      ]
    }
  }]