netlify-config
Installation
SKILL.md
Netlify configuration
netlify.toml lives at the repo root (or set base/package directory for monorepos). Settings in netlify.toml override the Netlify UI on conflict. _headers and _redirects are extensionless plain-text files in the publish directory, processed before netlify.toml rules.
Footguns (read first)
- Env vars in
netlify.tomlare NOT available to functions or edge functions at runtime — reading them there returnsundefined. Vars declared innetlify.tomlonly get the Builds and Post processing scopes. Set runtime vars in the UI or withnetlify env:set. - Never put secrets in client-prefixed vars (
VITE_,NEXT_PUBLIC_,PUBLIC_, …) — they are inlined into the client bundle.--secretdoes not protect them. .envis not read by the Netlify build system — import variables into Netlify first (netlify env:import). The CLI reads.envonly for local builds.- Direct env injection into
netlify.toml(key = "$VAR") is unsupported — except signed proxy redirects. Use a build plugin orsedin the build command. [[redirects]]and[[headers]]are global — NOT context-aware, cannot be scoped to branches/contexts. Workaround: per-context build command copies a custom file into the publish directory.- Proxy rewrites time out at 26 seconds. HTTP
307is unsupported — use302.