2

My rewrites are not working on netlify/production but I have no problems when running them locally with netlify dev.

The netlify.toml looks like this:

[build]
command = "npm run build"
functions = "functions"
publish = "dist"

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

The npm run build command just calls nuxi build.

Now on localhost I can call /api/something and it works without a problem. The same call fails when deployed to netlify. It works also on production when I use /.netlify/functions/something.

Now the weird thing: When I remove publish = "dist" from the netlify.toml file I can call /api/something on production but then the nuxt code does not work, like all the pages.

I setup functions first and my desktop client is already using it which breaks when I just use /.netlify/functions/something because they are already using /api/something.

Does someone have a similar build who can help me?

teh.fonsi
  • 3,040
  • 2
  • 27
  • 22

1 Answers1

0

in someone is still having this issue, please the _redirects file in your public folder. the file gets copied over at build.

More info here [https://v3.nuxtjs.org/guide/directory-structure/public]

Ade
  • 631
  • 5
  • 8