build
build copied to clipboard
Don't create context-specific redirects in netlify.toml
Recently a customer shared their netlify.toml with us and we discovered hundreds of redirects like this, which attempt to leverage a [[context]]
:
[[context.release.redirects]]
from = "/assets/dist/json/animations/stats-rotator-small.json"
to = "/assets/dist/json/animations/stats-rotator-small.json"
status = 200
However, per an internal discussion in netlify slack, this does not actually seem to be a supported feature of our redirects. Netlify's docs say the same thing:
Certain keys, such as [build] and [[plugins]] but not [[redirects]] or [[headers]], allow you to set [context] properties based on the kind of deploy. These keys are context-aware.
Hey can someone clarify the behaviour for me that we should create for the user?
- Is it just omitting the "faulty" redirects and then logging an error message?
- should we error the build?
- or should we try to implement the feature for context aware redirects?
cc @kitop, @fool
Lets go with option one:
Omitting the "faulty" redirects and then logging an error message?
The context-specific redirects are being ignored currently so this won't change the behavior for the user, and they will get at least a warning.
There shouldn't be a user warning. This isn't something they control. We should just ensure that they can't be created.