I am getting an “Invalid Host header” message when connecting to webpack-dev-server remotely

后端 未结 10 1983
粉色の甜心
粉色の甜心 2020-12-02 04:57

I am using as an environment, a Cloud9.io ubuntu VM Online IDE and I have reduced by troubleshooting this error to just running the app with Webpack dev server.

I l

10条回答
  •  庸人自扰
    2020-12-02 05:35

    The more secure option would be to add allowedHosts to your Webpack config like this:

    module.exports = {
    devServer: {
     allowedHosts: [
      'host.com',
      'subdomain.host.com',
      'subdomain2.host.com',
      'host2.com'
       ]
      }
    };
    

    The array contains all allowed host, you can also specify subdomians. check out more here

提交回复
热议问题