fix(socketio): send correct url for auth
in case, an app uses a different frontend stack on a different development server, socketio should use the correct webserver port when authenticating
This commit is contained in:
parent
385fa8aaef
commit
be85c246ff
1 changed files with 12 additions and 1 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue