Situation: I was trying to allow requests to /random to be proxied to /api/random.
I edited my netlify.toml to add this:
[[redirects]]
from = "/random"
status = 200 # turns the redirect into a proxy
to = "/api/random"
But ended up getting this output under out_publish/_redirects (i.e. the custom proxy wasn't registered):
# Next-on-Netlify Redirects
/ /.netlify/functions/next_index 200
/api/random /.netlify/functions/next_api_random 200
/* /:splat 200
I tried creating a _redirects file instead:
This was being picked up in the output 🎉
/random /api/random 200!
# Next-on-Netlify Redirects
/ /.netlify/functions/next_index 200
/api/random /.netlify/functions/next_api_random 200
/* /:splat 200
However, requests to /random continued to 404. I guessed this was because Netlify only allow one hop. So I changed the contents or _redirects to:
/random /.netlify/functions/next_api_random 200!
...and now it's doing what I want 😁
I don't think there's much we can do about the one-hop limit, but next-on-netlify claims to look at the netlify.toml for redirects, and that doesn't appear to be working 🤔 is this a bug?