We’re working on making a breaking change in how our redirects feature works regarding file shadowing. We want to explain to you why we’re making this change and how it can affect your sites on Netlify.
Forced rules and shadowing
To understand these changes, there are two concepts that you need to know first.
First, Netlify redirects have the concept of forced rules. These rules can be expressed in two ways: in a
_redirects file with an exclamation point after the status code, for example
301!, or in your Netlify configuration file with the key and value
force=true. These forced rules will always take effect.
Netlify redirects also support the concept of file shadowing. With this feature, we check if a file exists for a given path before applying a redirect rule. If a file exists, we will serve that file rather than applying the rule, unless the rule is forced, because forced rules always take effect.
Unfortunately, over the years, we encoded some conditions in our code base that made rules without explicit force configuration to act as forced rules. For example, a proxy rule like
/* /index.html 200 will be forced under certain conditions, but we never intended for this to happen. These conditions have very unexpected side effects, and we want to remove these side effects all together.
So this is the change that we’re making: starting on April 7th, only rules with explicit force configurations set by you will be forced rules. If you have a redirect rule that’s not explicitly marked as forced, and you also have a file under the same path, we will serve the file.
We want you give you a heads up before this change takes effect. Besides this announcement, we’re going to send email notifications to the owners of sites that we know might be affected by this change.
What you can do
If you receive an email that your site might be affected by the change, check your redirect rules.
The email will list rules that are not configured to be forced, but are redirecting past existing content due to the current bug The email lists rules that could be affected by this bug. We decided to be more proactive the first time we sent this notification to ensure that you don’t miss any of them. If you want to keep redirecting past that content, add the
! (if it’s in a
_redirects file) or
force=true (if it’s in a
netlify.toml file) to the rule to make it a forced rule.
Any rules you don’t change will start following the expected shadowing behavior on April 7th.
We’re here to help!
If you have specific questions about changes as they impact your site(s), or want to test the changes in advance, please post a response and we’ll be happy to work with you further.