我有一個(gè) Go 代理服務(wù)器,它將傳入的請(qǐng)求代理到不同的 nginx 服務(wù),其中部署了一堆從 Hugo 生成的靜態(tài)文件。Go代理服務(wù)器代碼是:func (w http.ResponseWriter, r *http.Request) { proxy := httputil.NewSingleHostReverseProxy(target) proxy.Transport = debug.Transport{} // Set some Debug TCP options here proxy.ServeHTTP(w, r)}創(chuàng)建debug.Transport如下:type Transport struct { Transport http.RoundTripper}func (d Transport) RoundTrip(r *http.Request) (*http.Response, error) { fmt.Println(r.Header) d.Transport = &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } return d.Transport.RoundTrip(r)}在調(diào)試傳輸中,我已經(jīng)忽略了 TLS 配置的證書檢查。如果我直接訪問提供hugo靜態(tài)文件的nginx url,那么靜態(tài)文件就可以完美加載。即使我除了 nginx 之外還從 nginx-ingress 訪問,靜態(tài)文件也可以正常使用。但是,當(dāng)通過 Go 代理提供請(qǐng)求時(shí),我收到錯(cuò)誤:Failed to find a valid digest in the 'integrity' attribute for resource 'https://<blah>/js/main.min.29b0315468c00226fa6f4556a9cebc0ac4fe1ce1457a01b22c0a06b329877383.js' with computed SHA-256 integrity 'Nk/s9htIgKJ5jeLFxUMWgIQGhxGZBKoEWtWEy2qYtJk='. The resource has been blocked.integerity知道如何在 Go http 代理中跳過這些檢查嗎?
如何通過代理繞過完整性檢查
當(dāng)年話下
2023-08-07 18:55:15