Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Invalid Host Header" in When running React App

Tags:

I am having one simple project of React JS and I am deploying into OSE. Also I am using below dependencies in my project.

 "webpack": "^2.2.0",  "webpack-dev-server": "^1.14.1",  "react": "^15.5.4",  "react-router-dom": "^4.1.1" 

also I am running my project through below build script.

"build": "SET NODE_ENV=production && webpack-dev-server --host 0.0.0.0 --inline --history-api-fallback --content-base . " 

Everything goes fine in OSE and Webpack is compiled successfully. But on accessing the url it shows "Invalid Host Header" on the webpage.

Could anyone help on this. Somewhat New in React.

Thanks in Advance.

like image 655
Bharat Sewani Avatar asked Apr 27 '17 06:04

Bharat Sewani


People also ask

What does invalid host header mean?

In the course of testing an application hosted on your local machine, you may receive an “Invalid Host Header” error message when testing on CrossBrowserTesting using a local connection. This error is most commonly caused by a misconfiguration of the application server that causes it to reject non-local connections.


1 Answers

At your webpack config, you could add disableHostCheck: true at devServer configuration. For example,

devServer: {   disableHostCheck: true } 
like image 187
Kenrick Avatar answered Sep 19 '22 00:09

Kenrick