无法通过局域网使用Squid代理访问SSLencryption的MAMP站点(非SSL站点工作正常)

我有一个运行在MAMP主机(mac os x)上的开发网站,我想在客户端机器上(也在移动设备上 – 所有mac os上)查看。 所有连接到相同的局域网(无线)。 我已经成功地在主机上设置了一个Squid代理,并且可以在普通浏览器中查看客户端上的HTTP主机。 但是我在查看SSLencryption的时遇到了一些麻烦。 在开发环境中使用SSL非常重要,因为我正在生产中使用它。 我希望有人能帮我弄清楚如何工作! 提前致谢。

我使用https://www.mydomain.dev:8899访问主机上的站点。 它在所有浏览器中都能正常工作。 本地IP:主机192.168.0.99 ,客户端192.168.0.98

我使用地址http://test.dev:8898在MAMP中设置了一个小testing虚拟主机,没有SSLencryption(它只是列出一个文件夹)。 我可以通过在浏览器中inputhttp://test.dev:8898在主机上访问它。 我创build了以下.pac文件,并将客户端计算机configuration为使用它进行代理configuration:

 function FindProxyForURL(url, host) { if (shExpMatch(url, "http://test.dev*")) { return "PROXY 192.168.0.99:3128; DIRECT"; } return "DIRECT"; } 

当我启动squid时,通过下面显示的squidconfiguration,我确实可以在所有浏览器上访问客户端机器上的http://test.dev:8898 ,就像在主机上一样。 大。 现在我为dev站点设置了以下.pac文件:

 function FindProxyForURL(url, host) { if (shExpMatch(url, "https://www.mydomain.dev*")) { return "PROXY 192.168.0.99:3128; DIRECT"; } return "DIRECT"; } 

但是我无法连接到客户端机器上的https://www.mydomain.dev:8899 ,在Chrome中获得ERR_CONNECTION_REFUSED ,在Firefox中获得“Unable to Connect”(无法连接)(在这两种情况下都非常快速的响应,没有明显的延迟)。

这两个请求的access.log如下所示:

 1486685792.999 58 192.168.0.98 TCP_MISS/200 1258 GET http://test.dev:8898/ - HIER_DIRECT/192.168.0.99 text/html 1486685793.556 1 192.168.0.98 TCP_MISS/404 443 GET http://test.dev:8898/favicon.ico - HIER_DIRECT/192.168.0.99 text/html 1486685797.211 1 192.168.0.98 TCP_DENIED/403 3992 CONNECT www.mydomain.dev:8899 - HIER_NONE/- text/html 1486685797.213 0 192.168.0.98 TCP_DENIED/403 3992 CONNECT www.mydomain.dev:8899 - HIER_NONE/- text/html 

cache.log中也有一个奇怪的错误,那就是:

 2017/02/09 09:09:42 kid1| WARNING: 'Name-of-host-machine' rDNS test failed: (0) No error. 2017/02/09 09:09:42 kid1| WARNING: Could not determine this machines public hostname. Please configure one or set 'visible_hostname'. 

这里是curl输出:

 → curl -v --proxy 192.168.0.99:3128 https://www.mydomain.dev:8899 * Rebuilt URL to: https://www.mydomain.dev:8899/ * Hostname was NOT found in DNS cache * Trying 192.168.0.99... * Connected to 192.168.0.99 (192.168.0.99) port 3128 (#0) * Establish HTTP proxy tunnel to www.mydomain.dev:8899 > CONNECT www.mydomain.dev:8899 HTTP/1.1 > Host: www.mydomain.dev:8899 > User-Agent: curl/7.37.1 > Proxy-Connection: Keep-Alive > < HTTP/1.1 403 Forbidden < Server: squid/3.5.23 < Mime-Version: 1.0 < Date: Fri, 10 Feb 2017 01:54:06 GMT < Content-Type: text/html;charset=utf-8 < Content-Length: 3516 < X-Squid-Error: ERR_ACCESS_DENIED 0 < Vary: Accept-Language < Content-Language: en < X-Cache: MISS from localhost < Via: 1.1 localhost (squid/3.5.23) < Connection: keep-alive < * Received HTTP code 403 from proxy after CONNECT * Connection #0 to host 192.168.0.99 left intact curl: (56) Received HTTP code 403 from proxy after CONNECT 

我尝试添加https_port 3130 transparent行下的https_port 3130 transparent行,然后使用.pac文件redirect到192.168.0.99:3130 ,但是这不起作用。 浏览器只是挂起等待连接,最终说连接被拒绝。

希望有人会知道这些错误是什么意思,我做错了什么! 非常感谢你的时间。


这是我的squid.conf文件:

 acl localnet src 192.168.0.0/24 # local subnet acl SSL_ports port 443 8899 acl Safe_ports port 8899 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl Safe_ports port 8898 # testdev site acl CONNECT method CONNECT http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localhost manager http_access deny manager http_access allow localnet http_access allow localhost http_access deny all http_port 3128 transparent coredump_dir /usr/local/var/cache/squid refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern . 0 20% 4320