fix: Allow all origins with credentials
This commit is contained in:
parent
05f416e448
commit
2ea0b58873
2 changed files with 25 additions and 9 deletions
|
|
@ -12,15 +12,29 @@ frappe.socketio = {
|
|||
return;
|
||||
}
|
||||
|
||||
//Enable secure option when using HTTPS
|
||||
// Enable secure option when using HTTPS
|
||||
if (window.location.protocol == "https:") {
|
||||
frappe.socketio.socket = io.connect(frappe.socketio.get_host(port), {secure: true});
|
||||
frappe.socketio.socket = io.connect(
|
||||
frappe.socketio.get_host(port),
|
||||
{
|
||||
secure: true,
|
||||
withCredentials: true,
|
||||
}
|
||||
else if (window.location.protocol == "http:") {
|
||||
frappe.socketio.socket = io.connect(frappe.socketio.get_host(port));
|
||||
);
|
||||
} else if (window.location.protocol == "http:") {
|
||||
frappe.socketio.socket = io.connect(
|
||||
frappe.socketio.get_host(port),
|
||||
{
|
||||
withCredentials: true,
|
||||
}
|
||||
else if (window.location.protocol == "file:") {
|
||||
frappe.socketio.socket = io.connect(window.localStorage.server);
|
||||
);
|
||||
} else if (window.location.protocol == "file:") {
|
||||
frappe.socketio.socket = io.connect(
|
||||
window.localStorage.server,
|
||||
{
|
||||
withCredentials: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!frappe.socketio.socket) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ const subscriber = get_redis_subscriber();
|
|||
|
||||
const io = require('socket.io')(conf.socketio_port, {
|
||||
cors: {
|
||||
origin: "*", // we are checking for hostnames before registering a socket
|
||||
// Should be fine since we are ensuring whether hostname and origin are same before adding setting listeners for s socket
|
||||
origin: true,
|
||||
credentials: true
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue