Setting reverse proxy (status=200) results in 301 redirect?

I’m attempting to set up Netlify as a reverse proxy for another API, but it doesn’t seem to be working – rather than reverse-proxying, Netlify is returning a 301 redirect?

Netlify site name: robertying.netlify.app

_redirects file:

❯ cat _redirects
/shengji https://shengji-api.robertying.com/shengji 200
/shengji/ https://shengji-api.robertying.com/shengji 200
/shengji/* https://shengji-api.robertying.com/shengji/:splat 200

Error:

❯ curl https://robertying.netlify.app/shengji -s -L -I -o /dev/null -w '%{url_effective}'
https://shengji-api.robertying.com/shengji/

Expected output: Play 升级 / Tractor / 找朋友 / Finding Friends online!

do you have a repo to look at?

It’s unfortunately a private repo, but there’s no netlify.toml. Let me see if I can set up a test repo which reproduces

ahh, never mind – looks like this might be my upstream returning a 301! Netlify seems to be doing its job.

1 Like