Tiny Wins Home

Netlify Redirects With Gatsby

May 08, 2020

Was having troubles with my functions redirect rule in netlify.toml file with my Gatsby site. Originally it looked like this:

[[redirects]]
  from = "/api/*"
  to = "/.netlify/functions/:splat"
  status = 200

But gatsby was taking over and serving a 404 for this route. But if you add the force key to the redirect everything works fine. Add it like this:

[[redirects]]
  from = "/api/*"
  to = "/.netlify/functions/:splat"
  status = 200
  force = true