WebSocket connection to ‘ws://localhost:8080/api/handler‘ failed: Invalid frame header

proxy:{
    '/api/handler':{
        target: {
            protocol: 'wss:',
            host: '172.31.4.248',
        },
        ws: true,
        changeOrigin: true,
        secure: false,
    }
}

如上项目中websocket配置的代理;初始建立连接没有问题,能连接成功 ;但是一会就报错(Invalid frame header)

项目解决方式是修改代理中ws:true改为false

proxy:{
    '/api/handler':{
        target: {
            protocol: 'wss:',
            host: '172.31.4.248',
        },
        ws: false,
        changeOrigin: true,
        secure: false,
    }
}

你可能感兴趣的:(vue,websocket,vue,websocket)