赞
踩
代理自动配置(PAC)文件是一个 JavaScript 脚本,其核心是一个 JavaScript 函数,用来决定网页浏览请求(HTTP、HTTPS,和 FTP)应当直连目标地址,还是被转发给一个网页代理服务器并通过代理连接。
以下配置保存到文件,扩展名为pac
function FindProxyForURL(url, host) { var proxy1 = "PROXY 192.168.6.6:6666"; var proxy2 = "PROXY 222.22.66.222:6666"; //本地地址直接连接 if (isPlainHostName(host)) { return "DIRECT"; } // 代理1 if (shExpMatch(url, "*baidu.com*")) { return proxy1; } // 代理2 if (shExpMatch(url, "*csdn.com*")) { return proxy2; } return "DIRECT"; }
以下配置保存到文件执行,扩展名为bat,windows的dos命令
@echo off
color 0a
title Use autoconfig script
echo Starting......
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /v DefaultConnectionSettings /t REG_BINARY /d 46000000020000000900 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /v SavedLegacySettings /t REG_BINARY /d 46000000020000000900 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /d "http://域名/pac/proxy.pac" /f
echo End
@echo off
出现此问题的原因是基于 Windows 10 的计算机上的 Internet Explorer 和 Microsoft Edge 使用 WinHttp 代理服务来检索代理服务器信息。 WinHttp 代理服务不支持对 PAC 文件使用 ftp:// 或 file:// 协议。
原文地址:
https://learn.microsoft.com/zh-cn/troubleshoot/developer/browsers/administration/cannot-read-pac-file
可以修改注册表配置后支持(需要重启系统)
配置内容
以下配置保存到文件执行,扩展名为reg,注册表命令
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings]
"EnableAutoproxyResultCache"=0
部分原文:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
Value: EnableAutoproxyResultCache
Type: REG_DWORD
Data value: 0 = disable caching; 1 (or key not present) = enable automatic proxy caching (this is the default behavior)If the registry key is not present, you can create the registry key by using the following registry file:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings]"EnableAutoProxyResultCache"=dword:00000000"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。