I need that when a url under /api/*
is matched it will rewrite but not change the status codes passed from the upstream server.
The issue with what I’ve found is that if I add a 200 status it rewrites, but I miss the upstream status. If I add 301 I keep the upstream status but I encounter cors.
Seems like a trivial task but from some reason I can’t find it, what am I doing wrong?
# example netlify.toml
[build]
command = "npm run build:prod"
functions = "netlify/functions"
publish = "dist"
## Uncomment to use this redirect for Single Page Applications like create-react-app.
## Not needed for static site generators.
[[redirects]]
from = "/api/*"
to = "https://dev.devcloud.zixi.com/:splat"
status = 401
[[redirects]]
from = "/api/*"
to = "https://dev.devcloud.zixi.com/:splat"
force = true
status = 200
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
## (optional) Settings for Netlify Dev
## https://github.com/netlify/cli/blob/main/docs/netlify-dev.md#project-detection
#[dev]
# command = "yarn start" # Command to start your dev server
# port = 3000 # Port that the dev server will be listening on
# publish = "dist" # Folder with the static content for _redirect file
## more info on configuring this file: https://docs.netlify.com/configure-builds/file-based-configuration/