Worker kv routing problem

I am using worker sites to host my site.
The site is an Angular app and I published it using wrangler cli.
It works fine when I access to The problem is that when I try to do the login the worker return HTTP 500 Error - could not find login/index.html in your content namespace.

In another site, I use S3 + cloudfront and this problem is solved by adding a rule
On 404, 403 return index.html.

I don’t know how to add this rule in Cloudflare workers.

Thanks in advance for your help!

Temporal solution:
I´ve created a new worker that return my index.html.
Then I added a route and attach my new worker. → get_index_worker

async function handleRequest(request) {
  const init = {
    headers: {
      'content-type': 'text/html;charset=UTF-8',

  const list = await fe_assets.list({"prefix": "index."})
  const html = await fe_assets.get(list.keys[0].name)
  return new Response(html, init)
addEventListener('fetch', event => {
  return event.respondWith(handleRequest(event.request))


1- I have to create a new route for every page to the same worker, for example

example. com /login
example. com /dashboard

2- The wrangler cli publish method, add a key to all my files when upload to KV.
Example Namespace/index.hfghf64utbg838rgfh46453t3g49. html
To get my index.html in the worker, first I have to do a LIST with a prefix and then the GET, it means 2 operations.

const list = await fe_assets.list({“prefix”: “index.”})
const html = await fe_assets.get(list.keys[0].name)