refactor(internal/handler): simplify HTTP client configuration and remove strict CSP header

This commit is contained in:
wood chen 2024-11-17 10:36:34 +08:00
parent c71698e5ad
commit 1e65ccad58

View File

@ -143,11 +143,7 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
// 发送代理请求
client := &http.Client{
Transport: &http.Transport{
DisableCompression: true, // 禁用自动压缩
},
}
client := &http.Client{}
resp, err := client.Do(proxyReq)
if err != nil {
@ -160,6 +156,9 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
copyHeader(w.Header(), resp.Header)
// 删除严格的 CSP
w.Header().Del("Content-Security-Policy")
// 设置响应状态码
w.WriteHeader(resp.StatusCode)