1001Ferramentas
🌐Dev

netlify.toml Generator

Generate a netlify.toml with build command, redirects and security headers ready for your Netlify deploy. Set it up in the browser and copy the file.



  

netlify.toml with SPA fallback and headers

Every single-page app hits the same wall on Netlify: you open /dashboard straight from the address bar and get a 404, because that file does not exist on disk and the router resolves it in JavaScript. The fix is a rewrite to /index.html with status 200. This generator hands you a netlify.toml that already has the rule, plus a build command and three security headers.

The output is fixed: no fields to fill in, the TOML shows up as soon as the page loads, and the button reprints the same text. Notice the status 200 on that redirect instead of 301 or 302. With 200, Netlify serves index.html while the URL stays put in the address bar, which is precisely what a client-side router needs. Files that genuinely exist are still served before the rule applies.

Adjust publish before shipping: dist matches Vite and Astro, but Create React App emits build. If your repo already has a _redirects file in public, note that it is evaluated before the rules in netlify.toml, and keeping both invites confusion. On a site with server routes, the catch-all rewrite gets in the way more than it helps, so drop that block. Nothing leaves your browser while it generates.

Frequently asked questions

Can I change the publish folder in the tool?
There is no field for it; the file always says publish = dist. Edit that line to match whatever folder your build actually produces.
Will the /* rewrite break my images and CSS?
No. Netlify serves existing files before applying the rule, so it only kicks in when the path matches no published file.
Can I add a Content-Security-Policy?
Yes, by hand: add a line inside [headers.values]. The generated file ships only X-Frame-Options, X-Content-Type-Options and Referrer-Policy.

Related Tools