From c7cf72030a1d4e10e1506dfe916d48cb17976f4a Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Thu, 10 Aug 2023 19:18:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run_all_server.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run_all_server.sh b/run_all_server.sh index 6d8a2033..fc8318dc 100755 --- a/run_all_server.sh +++ b/run_all_server.sh @@ -22,6 +22,8 @@ run_server() { cd - > /dev/null } +find /tmp/go-build* -mmin +5 -delete + # 列出所有服务器目录 server_dirs=() # 初始化一个空数组 From 1998b62ab9a3ae526d4b4ad36dcb86593c03c6cd Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Mon, 21 Aug 2023 15:26:25 +0800 Subject: [PATCH 2/3] fix --- proxyserver/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proxyserver/main.go b/proxyserver/main.go index 811f6476..49025cf6 100644 --- a/proxyserver/main.go +++ b/proxyserver/main.go @@ -81,6 +81,12 @@ func main() { fs := http.FileServer(http.Dir(vueBuild)) indexHtmlPath := vueBuild + "/index.html" mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + + err := r.ParseMultipartForm(100 << 20) + if err != nil { + log.Println(err) + } + if strings.HasPrefix(r.URL.Path, "/api/") { // 对/api开头的请求进行反向代理 proxy := httputil.NewSingleHostReverseProxy(apiURL) From 71fa12648025ad1707f2d63fc0c775fdd252551b Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Mon, 21 Aug 2023 15:27:24 +0800 Subject: [PATCH 3/3] fix --- proxyserver/main.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/proxyserver/main.go b/proxyserver/main.go index 49025cf6..ac033fdd 100644 --- a/proxyserver/main.go +++ b/proxyserver/main.go @@ -150,18 +150,10 @@ func NewBackend(mux *http.ServeMux, httpAddress string, muxPaths ...string) *Bac }, } - dialer := &websocket.Dialer{ - Proxy: http.ProxyFromEnvironment, - NetDial: func(network, addr string) (net.Conn, error) { - return net.Dial(network, addr) - }, - } - // 创建后端服务对象,包含地址和客户端 backend := &Backend{ HttpAddress: httpAddress, Client: client, - Dialer: dialer, } // 创建处理请求的函数 @@ -198,6 +190,7 @@ func NewBackend(mux *http.ServeMux, httpAddress string, muxPaths ...string) *Bac header.Del("Sec-Websocket-Key") header.Del("Sec-Websocket-Version") header.Del("Connection") + // header.Del("Origin") proxyConn, _, err := backend.Dialer.Dial(target.String(), header) if err != nil {