Serving a single-page app via create-react-app from a subdirectory using Cloudflare Workers

Hi everyone,

I’m currently serving a single-page app via create-react-app from the root of my domain (with the route set up as*), but I would like it to be hosted from a subdomain (*).

To enable single-page functionality, I’m following the guidance here:

To try to get the subdomain working, I tried following the guidance here: (setting the homepage field in package.json and setting basename on the ReactRouter). However, when I build and deploy, the assets are still being served from the root.

In the long run, I would like to be able to have different workers handle different subdomains (kind of like namespaces). For example:

`/`         => root-worker   (handles only the root homepage)
`/route1/*` => route1-worker (handles all routes under the `route1` namespace)
`/route2/*` => route2-worker (handles all routes under the `route2` namespace)

Each worker app should not know about the others or rely on their existence and they would just handle their own namespaced routes while Cloudflare Workers handles the top-most level routes.

I would really appreciate any help I could get to make this work.

Thank you!