Is there something similar to _redirects file for Workers Site?

Hi,

I’m new to Cloudflare. I used this guide to deploy my static assets to Workers Sites.
https://developers.cloudflare.com/workers/configuration/sites/start-from-existing/

But I’m curious does the Workers Sites have something similar to pages _redirects file.
https://developers.cloudflare.com/pages/configuration/redirects/

This topic https://community.cloudflare.com/t/workers-sites-redirects/171309 tells no. More than 3 years passed by. So may be something like that appeared?

Thank you.

Or may be I can change the code that serves static files to redirect some urls?
(The code given here https://developers.cloudflare.com/workers/configuration/sites/start-from-existing/)

The code that serves static files is as follows

import { getAssetFromKV } from '@cloudflare/kv-asset-handler';
import manifestJSON from '__STATIC_CONTENT_MANIFEST';
const assetManifest = JSON.parse(manifestJSON);

export default {
  async fetch(request, env, ctx) {
    try {
      // Add logic to decide whether to serve an asset or run your original Worker code
      return await getAssetFromKV(
        {
          request,
          waitUntil: ctx.waitUntil.bind(ctx),
        },
        {
          ASSET_NAMESPACE: env.__STATIC_CONTENT,
          ASSET_MANIFEST: assetManifest,
        }
      );
    } catch (e) {
      let pathname = new URL(request.url).pathname;
      return new Response(`"${pathname}" not found`, {
        status: 404,
        statusText: 'not found',
      });
    }
  },
};

If someone is interested in the same feature I’ve made a repo
https://github.com/yell0w4x/cloudflare-static-redirects.

Hi!

I’m just curious. Why did you use Workers Sites and not Pages, only to then recreate some Pages functionality?

There is a very clear warning at the top of the documentation you linked:

Is there any functionality in Worker Sites that is missing in Pages?

Hi, thank you for the response.

Yeah, I’ve seen this warning. But with Pages I’m bound to setup domain by hands via CNAME dns records. And with Workders Sites I’m able to accomplish everything I need by wrangler cli and scripts only.