This commit is contained in:
eson 2023-08-30 11:44:21 +08:00
parent 0d07d3e988
commit b493a2b149

View File

@ -84,14 +84,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/") {
err := r.ParseMultipartForm(100 << 20)
if err != nil {
log.Println(err)
}
// 对/api开头的请求进行反向代理
proxy := httputil.NewSingleHostReverseProxy(apiURL)
proxy.ServeHTTP(w, r)