This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hi I'm stuck trying to get my mern app to work on heroku. I am getting 404 errors when I make requests from my frontend to my backend. I am using this to deploy my frontend https://github.com/mars/create-react-app-buildpack
This my static.json file, API_URL is an env variable on heroku.
{
"root": "build/",
"routes": {
"/**": "index.html"
},
"proxies": {
"/api/": {
"origin": "${API_URL}"
}
}
}
my calls look like this: axios.get('/api/spotify/new-releases')
my heroku front end logs:
2019-01-07T17:52:09.099153 00:00 app[web.1]: 10.16.177.123 - - [07/Jan/2019:17:52:09 0000] "GET /api/spotify/new-releases HTTP/1.1" 404 159 "https://albumfied.herokuapp.com/home" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
and my backend:
2019-01-07T17:52:09.092862 00:00 heroku[router]: at=info method=GET path="/spotify/new-releases" host=albumfied-server.herokuapp.com request_id=be992da8-7bf9-4fe1-986e-a6007581fcd6 fwd="98.242.149.225,54.198.236.35" dyno=web.1 connect=2ms service=6ms status=404 bytes=403 protocol=https
I think the problem is that my frontend and backend urls are not matching, maybe my proxy is not set up properly. I've been trying to fix this for several days now and I haven't been able to. I'd really appreciate any help, thanks.
Subreddit
Post Details
- Posted
- 5 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/Heroku/comm...