[英]How do I connect to a webpack dev server running in codeanywhere
I am having issues connecting to a webpack dev server running in codeanywhere.我在连接到在 codeanywhere 中运行的 webpack 开发服务器时遇到问题。 I have the following in my webpack.config.js:
我的 webpack.config.js 中有以下内容:
devServer: {
// "disableHostCheck" added due to issue: https://github.com/webpack/webpack-dev-server/issues/1604
// Fix should be done with: https://github.com/webpack/webpack-dev-server/pull/1608
disableHostCheck: true,
headers: {
'Access-Control-Allow-Origin': '*'
},
host: '0.0.0.0',
allowedHosts: [
'.codeanyapp.com'
],
public: 'port-4200.<container-address>.codeanyapp.com'
} }
These are the dev server start parameters:这些是开发服务器启动参数:
--https --port 4200
I am having no success with either of the following URLs:我对以下任一 URL 都没有成功:
http://port-4200.<container-address>.codeanyapp.com/
https://port-4200.<container-address>.codeanyapp.com/
Any ideas what to try next?任何想法接下来要尝试什么?
Edit: Looks like a https issue, I can get the server talking via http.编辑:看起来像 https 问题,我可以通过 http 让服务器通话。 Any idea what the correct openssl parameters are to generate a self signed certificate that works in chrome?
知道正确的 openssl 参数是什么来生成适用于 chrome 的自签名证书吗?
I had the same issue.我遇到过同样的问题。 What fixed it for me was setting the devServer property in webpack.config.js like so:
为我解决的问题是在 webpack.config.js 中设置 devServer 属性,如下所示:
devServer: {
host:'0.0.0.0',
port: 4200,
contentBase: path.join(__dirname, [your path]),
watchContentBase: true,
compress: true,
disableHostCheck: true
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.