Webpack dev服务器代理不适用于ws

时间:2018-01-24 14:40:47

标签: webpack websocket proxy webpack-dev-server

这是我的webpack-dev-server配置:

devServer: {
    contentBase: path.join(__dirname, 'dist'),
    port: 3000,
    hot: false,
    inline: false,
    historyApiFallback: true,
    proxy: [
        {
            path: 'ws://',
            target: 'ws://localhost:9000',
            ws: true,
            secure: false,
        },
        {
            path: '/',
            target: 'http://localhost:9000',
            secure: false,
            changeOrigin: true,
        },
    ]
},

问题是,ws请求引发了这个错误:

WebSocket connection to 'ws://api2/someSocket' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED

我的配置有什么问题?

0 个答案:

没有答案