diff --git a/proxy/handler.go b/proxy/handler.go index 093135d..d7d6aaf 100644 --- a/proxy/handler.go +++ b/proxy/handler.go @@ -144,35 +144,6 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } defer resp.Body.Close() - // 处理 404:尝试从 Referer 提取正确路径 - if resp.StatusCode == 404 { - if referer := r.Header.Get("Referer"); referer != "" && strings.Contains(referer, "/p/"+token) { - if u, err := url.Parse(targetURL); err == nil && u.Host != "" { - // 直接使用原始 targetURL 的 host + path - baseURL := u.Scheme + "://" + u.Host - correctPath := u.Path - if u.RawQuery != "" { - correctPath += "?" + u.RawQuery - } - - newTargetURL := baseURL + correctPath - - // 避免重复请求相同 URL - if newTargetURL != targetURL { - retryReq, _ := http.NewRequest(r.Method, newTargetURL, nil) - h.setProxyHeaders(retryReq, r) - - if retryResp, err := client.Do(retryReq); err == nil && retryResp.StatusCode == 200 { - resp.Body.Close() - resp = retryResp - defer resp.Body.Close() - log.Printf("404 retry success: %s -> %s", targetURL, newTargetURL) - } - } - } - } - } - body, err := h.readResponseBody(resp) if err != nil { log.Printf("Failed to read response: %v", err)