Skip to content

Instantly share code, notes, and snippets.

@wen-long
Last active May 20, 2022 13:39
Show Gist options
  • Save wen-long/6020543 to your computer and use it in GitHub Desktop.
Save wen-long/6020543 to your computer and use it in GitHub Desktop.

#WPAD设置 ##WPAD可以通过DHCP,这是建议的解决方案。

  1. a wpad file. This is the same javascript file as the pac file, renamed (or symlinked) to wpad.dat
  2. a web server to host the wpad.dat script. The wpad script needs to be located in the document root of the http server
  3. the web server must be configured for .dat files with a MIME type of "application/x-ns-proxy-autoconfig"
  4. a dhcp server, configured with option 252 = "http://your.server.here/wpad.dat"

  1. 一个 wpad 文件。跟 pac 文件是一样的,只是改名为 wpad.dat
  2. 存放 wpad.dat 文件的 WEB 服务器,文件位置必须是 www 主机的根目录下比如 http://192.168.8.1/wpad.dat
  3. WEB 服务器必须设置为XXX(看不懂,没接触过)
  4. dhcp 服务器,配置文件要有dhcp-option=252,http://192.168.8.1/wpad.dat

openwrt 的 dnsmasq 可能在 /etc/dnsmasq.conf只需编辑加入dhcp-option=252,http://192.168.8.1/wpad.dat即可。

FF 不支持通过 DHCP 配置的 WPAD 只支持 DNS 配置的 WPAD,所以在 host 文件(建议在 DHCP 服务器上进行修改,在本机修改也可以)中加入192.168.0.1 wpad使得主机 ping wpad 结果为服务器的地址

sample lighttpd wpad setup

 ## /etc/lighttpd/lighttpd.conf
mimetype.assign = (
    		".html"    =>   "text/html",
   			".txt"     =>   "text/plain",
		".wpad"    =>   "application/x-ns-proxy-autoconfig",
		[...]
)
[...]	

sample dnsmasq wpad setup

## dnsmasq is a combined dns and dhcp server
## 	/etc/dnsmasq.conf
dhcp-option=252,http://your.server.here/wpad.dat 

###参考页面

  1. Proxy Automatic Configuration
  2. Setting up Web Proxy Autodiscovery Protocol (WPAD) using DNS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment