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

后端 未结 10 1976
粉色の甜心
粉色の甜心 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:39

    I found out, that I need to set the public property of devServer, to my request's host value. Being that it will be displayed at that external address.

    So I needed this in my webpack.config.js

    devServer: {
      compress: true,
      public: 'store-client-nestroia1.c9users.io' // That solved it
    }
    

    Another solution is using it on the CLI:

    webpack-dev-server --public $C9_HOSTNAME <-- var for Cloud9 external IP

提交回复
热议问题