Why do some rewrites allow shadowing by default?

The rewrites and proxies documentation says:

By default, you can’t shadow a URL that actually exists within the site when using a splat or dynamic path segment

However, when trying to setup rewrites to my serverless function, I noticed that this isn’t the case when rewriting to non-HTML files or to /404.html:

/*    /style.css                              200
/*    /404.html                               200
/*    /.netlify/functions/my-function/:splat  200
/:id  /.netlify/functions/my-function?id=:id  200

The splat examples trigger for every URL and the path segment example triggers for every URL with one segment, which conflicts with the documentation. (The last example is what I’m actually trying to do in my application.)

Which is intended, the documentation or the actual behavior?

(Note that I’ve only tested these locally with netlify dev but because the same engine is used in production and locally, I assume this situation also exists for deployments. (Though I can always be wrong).)


The intended behavior is what is documented and it should be what you experience when deployed. I do see that you have filed an issue (https://github.com/netlify/cli/issues/705) in the cli repo (thank you!). I believe that’s the right place to report the issue you are seeing.