Support Forums

Redirect with tail match

Is it possible to attach redirects (for edge handler or redirect rules) using a tail match.
For example

/*/index.resp.json 200 EdgeHandler=response


/*/index.resp.json 200 Roles=admin

Currently I need 3000 specific rewrite rules for each of those files which does seem rather silly.
But as far as I know this didn’t previously work.

Hi @richtera,

Unfortunately, such a configuration is not supported. The closest option is this: Redirect options | Netlify Docs. You can use placeholders, but they won’t act as wildcard.

The only other option I can think of is to generate a _redirects file along with your build process. You Would have to write some code to dynamically add the rules for the required paths.

I can understand this is far from ideal, and we do have feature requests asking to support this, but there’s no information on if/when that would be available.

Ok, I am generating _redirects, but was trying to avoid a lot of replicated rules for a certain file that can be located in about 3000 different directories. Until I can use edge handlers, this is getting really slow with a large TTFB

Hi @richtera,

I can see how that would be a problem, but it’s a problem without any immediate solution at the moment. I’m sorry to not have better news.