diff --git a/realtime/utils.js b/realtime/utils.js index 0ff3be0a49..85df2f9157 100644 --- a/realtime/utils.js +++ b/realtime/utils.js @@ -1,8 +1,19 @@ +const { get_conf } = require("../node_utils"); +const conf = get_conf(); + function get_url(socket, path) { if (!path) { path = ""; } - return socket.request.headers.origin + path; + let url = socket.request.headers.origin; + if (conf.developer_mode) { + let [protocal, host, port] = url.split(':'); + if (port != conf.webserver_port) { + port = conf.webserver_port; + } + url = `${protocal}:${host}:${port}`; + } + return url + path; } module.exports = {