Dynamic Proxy Auto-Configuration (PAC) generator written in PHP
Simply copy the files from the www
directory to any location within your PHP web server's web root, and copy the files from the data
directory to a location outside the web root. Then, make sure that CONFIG_DIR_PATH_DATA
in config.php
points to the pac.config.d
directory.
Add custom hostname list files to the data/pac.config.d/hostnames/
directory, and add custom rule config files to the data/pac.config.d/configs/
directory.
You can find configuration examples in data/pac.config.d/
, along with their corresponding generated PAC files in example_results/
.
config file | URL | PAC file |
---|---|---|
example_1.json | pac.php?config=example_1 pac.php?config=example_1&debug=1 |
example_1.pac example_1.debug.pac |
example_2.json | pac.php?config=example_2 pac.php?config=example_2&debug=1 |
example_2.pac example_2.debug.pac |
example_3.json | pac.php?config=example_3 pac.php?config=example_3&debug=1 |
example_3.pac example_3.debug.pac |
Tested in PHP 7 and PHP 8 environments.
(optional) To support compression, use mod_defalte
and modify /etc/apache2/mods-enabled/deflate.conf
:
AddOutputFilterByType DEFLATE application/x-ns-proxy-autoconfig
- Add the
debug
URL parameter:
pac.php?config=example_1&debug=1
- Make sure PAC is working
- Open
chrome://net-export/
, export log file - Run command:
tail -f chrome-net-export-log.json | grep -F '[PAC]'
The output will be helpful for debugging.
This repo is licensed under the GNU General Public License v3.0.