From 038ac93db4e105faccca72be7b8471ef5e71fbe3 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Tue, 5 Sep 2023 12:22:32 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/datatransferlogic.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index a935d901..ed280130 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -84,7 +84,7 @@ var ( //允许跨域的origin mapAllowOrigin = map[string]struct{}{ "https://www.fusen.3718.cn": struct{}{}, - //"http://www.fusen.3718.cn": struct{}{}, + "http://www.fusen.3718.cn": struct{}{}, } ) @@ -117,11 +117,11 @@ type wsConnectItem struct { // 请求建立连接,升级websocket协议 func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request) { //判断是不是允许的origin - if _, ok := mapAllowOrigin[r.Header.Get("Origin")]; !ok { + /*if _, ok := mapAllowOrigin[r.Header.Get("Origin")]; !ok { upgrader.CheckOrigin = func(r *http.Request) bool { return false } - } + }*/ //把子协议携带的token设置到标准token头信息中 token := r.Header.Get("Sec-Websocket-Protocol") //有token是正常用户,无则是白板用户,也可以连接