I’m trying to set up a couple of redirect rules for our site on Netlify. I added a netlify.toml
file with the following redirects:
[[redirects]]
from = "/api/*"
to = "https://my-site.com/api/*"
status = 200
force = true
[[redirects]]
from = "/*.js.map"
to = "/forbidden"
staus = 403
force = true
The first is for proxying requests to our API server, basically I want a call to https://my-site.netlify.com/api/some-api
to go to https://my-site.com/api/some-api
and get the response code etc. set by the server. Is that possible with a redirect?
Note that the requests are both GET
and POST
requests, and currently I’m getting a 404 status code back.
The second is for blocking access to source maps. Ideally we’d also have access to these based on Roles, but for now I’ll be fine with them being blocked altogether. The issue is that even though the above is set up, I still get source maps as usual in the DevTools, and accessing the files works as if the redirect wasn’t there.
Please advise, I couldn’t find a log of the redirects activity. I did check our API server, and am seeing no requests hitting it from Netlify.