Skip to content

Phuker/PAC-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PAC-gen

Dynamic Proxy Auto-Configuration (PAC) generator written in PHP

Quick start

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.

Examples

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

Web server

Tested in PHP 7 and PHP 8 environments.

apache

(optional) To support compression, use mod_defalte and modify /etc/apache2/mods-enabled/deflate.conf:

AddOutputFilterByType DEFLATE application/x-ns-proxy-autoconfig

nginx

How to debug

Google Chrome

  1. Add the debug URL parameter:
pac.php?config=example_1&debug=1
  1. Make sure PAC is working
  2. Open chrome://net-export/, export log file
  3. Run command:
tail -f chrome-net-export-log.json | grep -F '[PAC]'

The output will be helpful for debugging.

FAQ

License

This repo is licensed under the GNU General Public License v3.0.

About

Dynamic Proxy Auto-Configuration (PAC) generator written in PHP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published