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?