Fix cross domain BOSH.

This commit is contained in:
John Livingston 2023-04-21 18:49:15 +02:00
parent ba573c1211
commit 4a02f74563
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC

View File

@ -216,6 +216,22 @@ async function initWebchatRouter (options: RegisterServerOptionsV5): Promise<Rou
}
}
)
// We should also forward OPTIONS request, for CORS.
router.options('/http-bind',
(req: Request, res: Response, next: NextFunction) => {
try {
if (!currentHttpBindProxy) {
res.status(404)
res.send('Not found')
return
}
req.url = 'http-bind'
currentHttpBindProxy.web(req, res)
} catch (err) {
next(err)
}
}
)
// Peertube >=5.0.0: Adding the websocket route.
if (registerWebSocketRoute) {