I do not understand why my headers or redirects don’t work when I put them in my netlify.toml file but they do work when I use a _headers and/or a _redirects file.
However the build and context part does work…
This is my netlify.toml file. I’ve kept it short by deleting all headers just for testing purposes.
[[redirects]]
from = "https://dev-domain.netlify.app/*"
to = "https://dev.domain.com/:splat"
status = 301
force = true
[build]
command = "npm run build"
publish = "dist"
[build.environment]
NODE_ENV = "production"
NODE_OPTIONS = "--max_old_space_size=4096"
NODE_VERSION = "18"
[context.branch-deploy.environment]
NODE_ENV = "development"
Thanks! I can see that there is a “wider” redirect in place, which is interfering with the one you intend:
[[redirects]]
from = "/*"
to = "/.netlify/functions/server"
status = 200
(the one you intend is just after it - but is never reached!)
I think that is a “standard” route added by our nuxt framework support, that is required, so you don’t want to remove that.
And, as to why your redirect does work when you put it in _redirects, we prepend_redirects to your configuration so it’ll show up before that default route; redirects from netlify.toml is added only at the end - after our automagic route - and is thus overridden.