Invalid Host Header when ngrok tries to connect to React dev server

后端 未结 4 1880
走了就别回头了
走了就别回头了 2021-01-29 17:04

I\'m trying to test my React application on a mobile device. I\'m using ngrok to make my local server available to other devices and have gotten this working with a variety of o

4条回答
  •  时光说笑
    2021-01-29 18:01

    If you use webpack devServer the simplest way is to set disableHostCheck, check webpack doc like this

    devServer: {
        contentBase: path.join(__dirname, './dist'),
        compress: true,
        host: 'localhost',
        // host: '0.0.0.0',
        port: 8080,
        disableHostCheck: true //for ngrok
    },
    

提交回复
热议问题