Support Forums

Connection to Heroku backend not working

I can’t figure out why my Netlify page can’t access my RoR backend on Heroku. When I run the build folder on port 5000, it works. When I navigate to the Netlify page, it doesn’t. I see the frontend html, but nothing from my db.
Thoughts? I did include

/* /index.html 200 
/api/*  http://myBackend.herokuapp.com/myPath/:splat  200

in a _redirects file, and changed my fetch requests to include the proper path.

Hi @DXRovang

Have a look at this great Support Guide. If you have any follow-up questions, happy to look at them

I think it’s a redirects problem. You’ve added a wildcard route /* that matches all the URLs of the website. This means even your /api/* route is actually getting redirected to /index.html.

You should move your /api/* route above the /* route so that it gets matched before the other one.