I get the error invalid host header
I don't know the reason please if anyone can help
.env
HOST=herokuapp.com
server.js
const express = require('express');
const path = require('path');
const app = express();
app.use(express.static(path.join(__dirname, 'build')));
app.get('*', function (req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
app.listen(process.env.PORT);
package.json
"proxy": "http://localhost:5000",
when write Heroku log
in console return this
if it will help you to find any solution and thanks all for trying
app[web.1]: Attempting to bind to HOST environment variable: herokuapp.com
app[web.1]: If this was unintentional, check that you haven't mistakenly set it in your shell.
app[web.1]: Learn more here: https://cra.link/advanced-config
app[web.1]:
app[web.1]: Could not find an open port at herokuapp.com.
app[web.1]: Network error message: listen EADDRNOTAVAIL: address not available 3.218.84.197
app[web.1]:
heroku[web.1]: Process exited with status 1
heroku[web.1]: State changed from starting to crashed
heroku[web.1]: State changed from crashed to starting
heroku[web.1]: Starting process with command `npm start`
app[web.1]:
app[web.1]: > [email protected] start
app[web.1]: > react-scripts start
app[web.1]:
app[web.1]: Attempting to bind to HOST environment variable: herokuapp.com
app[web.1]: If this was unintentional, check that you haven't mistakenly set it in your shell.
app[web.1]: Learn more here: https://cra.link/advanced-config
app[web.1]:
app[web.1]: Could not find an open port at herokuapp.com.
app[web.1]: Network error message: listen EADDRNOTAVAIL: address not available 23.21.41.134
app[web.1]:
heroku[web.1]: Process exited with status 1
heroku[web.1]: State changed from starting to crashed
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ahmed-radi-bank-system.herokuapp.com request_id=1fe76374-c2b2-4742-8274-ac29595f176b fwd="156.222.196.219" dyno= connect= service= status=503 bytes= protocol=https
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ahmed-radi-bank-system.herokuapp.com request_id=729f1256-9d7e-4cfa-83e7-0fcb59b886a2 fwd="156.222.196.219" dyno= connect=
service= status=503 bytes= protocol=https
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ahmed-radi-bank-system.herokuapp.com request_id=7cea8936-c5d5-4171-9c79-e6795e805cc9 fwd="156.222.196.219" dyno= connect= service= status=503 bytes= protocol=https
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ahmed-radi-bank-system.herokuapp.com request_id=581a5de7-c23d-496e-a27f-5ade070cc55b fwd="156.222.196.219" dyno= connect=
service= status=503 bytes= protocol=https
CodePudding user response:
chek this answer might helps: https://stackoverflow.com/a/54702018/15319747
sorry this should be a comment but i can't comment...
CodePudding user response:
I will upload my project on Netify