diff --git a/proxyserver/main.go b/proxyserver/main.go index 811f6476..ac033fdd 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) @@ -144,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, } // 创建处理请求的函数 @@ -192,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 { 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=() # 初始化一个空数组