解决反向代理错误ERR_CONTENT_DECODING_FAILED
配置反向代理并非易事。 它涉及一些反复试验和处理意外错误。 这些错误之一是 ERR\_CONTENT\_DECODING\_FAILED。 该网站不会在您的浏览器中加载,Chrome 将显示以下错误消息:
当在反向代理上配置资源并且后端通信正常时,ERR\_CONTENT\_DECODING\_FAILED错误可能会显示在您的浏览器中。 也就是说:**后端正在返回数据,但不是以浏览器期望的形式**。 **就像:浏览器期望 GZIP 响应,但接收纯文本。 因此提示内容解码失败。 已收到内容,但浏览器无法解码/理解数据。**
要解决此错误,请重置反向代理配置中的 Accept-Encoding 请求标头。
Apache
RequestHeader unset Accept-Encoding
http://httpd.apache.org/docs/current/mod/mod_headers.html
Example Apache configuration section for a location named test.
<Location /test>
RequestHeader unset Accept-Encoding
ProxyPass https://0.0.0.0:443
ProxyPassReverse https://0.0.0.0:443/
Order allow,deny
Allow from all
</Location>
NGINX
proxy_set_header Accept-Encoding "";
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header
还没有评论,来说两句吧...