按照 httpd-proxy.conf 样例
<IfModule proxy_module>
<IfModule proxy_http_module>
#
# Reverse Proxy
#
ProxyRequests Off
<Proxy *>
Require all granted
</Proxy>
ProxyPass / https://www.baidu.com/
ProxyPassReverse / https://www.baidu.com/
</IfModule>
</IfModule>
此外,下面这几行也尤为重要,有加入到 <IfModule> 中
# 不支持压缩数据,这个很重要,否则在处理数据时需要解压
RequestHeader unset Accept-Encoding
# 被指定为接受 gzip 压缩数据
# Header set Content-Encoding gzip
# 设定代理的 User Agent ,不设定则跟随用户的ser Agent 。这里设定为安卓手机浏览器
RequestHeader set User-Agent "Mozilla/5.0 (Linux; Android 10; V1911A Build/QP1A.190711.020) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 YaBrowser/18.4.1.498.00 Mobile Safari/537.36"
# 支持SSL
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
#RequestHeader set X-Forwarded-Proto "https"
#RequestHeader set X-Forwarded-Port "443"
# 需要开启缓存模块
# CacheEnable disk /
# CacheRoot d:/htdocs/cache
# CacheDefaultExpire 86400
# 后端的连接
ProxyTimeout 60
# 由后端转发主机头
# ProxyPreserveHost On