mirror of
https://github.com/woodchen-ink/proxy-go.git
synced 2025-07-18 16:41:54 +08:00
refactor(internal/handler): simplify HTTP client configuration and remove strict CSP header
This commit is contained in:
parent
c71698e5ad
commit
1e65ccad58
@ -143,11 +143,7 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 发送代理请求
|
// 发送代理请求
|
||||||
client := &http.Client{
|
client := &http.Client{}
|
||||||
Transport: &http.Transport{
|
|
||||||
DisableCompression: true, // 禁用自动压缩
|
|
||||||
},
|
|
||||||
}
|
|
||||||
resp, err := client.Do(proxyReq)
|
resp, err := client.Do(proxyReq)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -160,6 +156,9 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
copyHeader(w.Header(), resp.Header)
|
copyHeader(w.Header(), resp.Header)
|
||||||
|
|
||||||
|
// 删除严格的 CSP
|
||||||
|
w.Header().Del("Content-Security-Policy")
|
||||||
|
|
||||||
// 设置响应状态码
|
// 设置响应状态码
|
||||||
w.WriteHeader(resp.StatusCode)
|
w.WriteHeader(resp.StatusCode)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user