I have been getting 502 errors for a rewrite to my API which is hosted on Heroku.
My Netlify site name is furnish-app.netlify.app
. My _redirects
file looks like this:
/api/* https://furnish-app.herokuapp.com/api/:splat 200
/* /index.html 200
https://furnish-app.netlify.app/* https://www.furnish.app/:splat 301!
When I make an API request directly to my API I get the expected response; e.g. https://furnish-app.herokuapp.com/api/stylequiz/1?productCategory=displaycabinet works correctly.
However when I do the same request via my Netlify URL which I get a 502 response; e.g. https://www.furnish.app/api/stylequiz/1?productCategory=displaycabinet should be getting rewritten to same URL as above but it in fact fails with a 502 error.
When I make requests via the latter URL I can see in my Heroku logs that the requests are coming through and they all have 200 statuses, so it looks like the request gets successfully redirected to the Heroku API but then something goes wrong on the way back from Heroku to Netlify. This is causing my app to be broken so any help would be really appreciated. Thanks!