Fix WebSockets prefix matching
Closed this issue · 0 comments
SaltFish001 commented
I config a wsProxy like this
mediaWS: {
proxyType: 'websocket',
target: `ws://${Env.MEDIA_SERVER || 'localhost:3009'}`,
prefix: `/rtp`,
},
but when I contenct like this
ws://192.168.135.2:4000/rtp/50010600001180000001_50010600001320000001.live.flv
It does not match this route, then I read the source code. I found the reason in here
in line 18-20
const prefix = url.pathname || '/'
// my prefix get **/rtp/50010600001180000001_50010600001320000001.live.flv**
// but I want **/rtp**
if (prefix2route.has(prefix)) { // maybe can use String.startWith instace?