From 101e589fddac75906180d7bf3e121857ab0e7a25 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Tue, 29 Aug 2023 15:03:45 +0800 Subject: [PATCH] fix --- proxyserver/main.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/proxyserver/main.go b/proxyserver/main.go index 0f98ac53..742a619a 100644 --- a/proxyserver/main.go +++ b/proxyserver/main.go @@ -85,12 +85,13 @@ func main() { 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/") { + + err := r.ParseMultipartForm(100 << 20) + if err != nil { + log.Println(err) + } + // 对/api开头的请求进行反向代理 proxy := httputil.NewSingleHostReverseProxy(apiURL) proxy.ServeHTTP(w, r)