From 1ba6a0ed64c54bb8299c0a32096c914f4c05503e Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Tue, 5 Sep 2023 14:07:33 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/datatransferlogic.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index 9bddedae..8c0536e2 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -117,13 +117,14 @@ type wsConnectItem struct { // 请求建立连接,升级websocket协议 func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request) { origin := r.Header.Get("Origin") + fmt.Println("*************:", origin) //判断是不是允许的host - upgrader.CheckOrigin = func(r *http.Request) bool { + /*upgrader.CheckOrigin = func(r *http.Request) bool { if _, ok := mapAllowOrigin[origin]; !ok { return false } return true - } + }*/ //把子协议携带的token设置到标准token头信息中 token := r.Header.Get("Sec-Websocket-Protocol") //有token是正常用户,无则是白板用户,也可以连接