mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #2330 from overleaf/bg-fix-realtime-proxy-exceptions
handle errors from realtime proxy connections GitOrigin-RevId: 9259975b24fad789eddbe87f0cdfa706b10c1470
This commit is contained in:
parent
45cdb94f8a
commit
2c0c21554a
1 changed files with 8 additions and 1 deletions
|
@ -9,7 +9,7 @@
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||||
*/
|
*/
|
||||||
const settings = require('settings-sharelatex')
|
const settings = require('settings-sharelatex')
|
||||||
|
const logger = require('logger-sharelatex')
|
||||||
const httpProxy = require('http-proxy')
|
const httpProxy = require('http-proxy')
|
||||||
const proxy = httpProxy.createProxyServer({
|
const proxy = httpProxy.createProxyServer({
|
||||||
target: settings.apis.realTime.url
|
target: settings.apis.realTime.url
|
||||||
|
@ -19,6 +19,13 @@ const wsProxy = httpProxy.createProxyServer({
|
||||||
ws: true
|
ws: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
proxy.on('error', function(error) {
|
||||||
|
logger.err({ proxyError: error }, 'realtime http proxy error')
|
||||||
|
})
|
||||||
|
wsProxy.on('error', function(error) {
|
||||||
|
logger.err({ proxyError: error }, 'realtime ws proxy error')
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
apply(webRouter, apiRouter) {
|
apply(webRouter, apiRouter) {
|
||||||
webRouter.all(/\/socket\.io\/.*/, (req, res, next) =>
|
webRouter.all(/\/socket\.io\/.*/, (req, res, next) =>
|
||||||
|
|
Loading…
Reference in a new issue