I have a simple notes app that uses react(create react app) in a client folder with a node express mongoose back end. If I try to upload to heroku it rejects it because of the proxy ("proxy": "http://localhost:3001") in the package.json in the client folder. If I get rid of the proxy it will upload to heroku no problem but because it's not there it won't talk to the back end so nothing works. When pushing to heroku with the proxy it will build but the app gives me "Invalid Host header". How do I go about fixing this? All I have tried is deleting the proxy.
3 Answers
1
votes
Are you using a fixed port in your app? Heroku assigns you a dynamic port that you must bind to, so you can't simply use a fixed port like 3001.
You should bind to process.env.PORT when running on Heroku instead. See runtime principles.
1
votes