sjitech / proxy-login-automator

A single node.js script to automatically inject user/password to http proxy server via a local forwarder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pac server not working

PupaRebbe opened this issue · comments

i ran the command to create a pac server, everything looks fine but it doesn't seem to work (maybe i didn't follow it right, in my case do i need to see a pac file at localhost:65010/dh.js ?)

Using parameters:
{
  "local_host": "localhost",
  "local_port": 65010,
  "remote_host": "https://example.com/dh.js",
  "remote_port": 443,
  "usr": "user",
  "pwd": "pass",
  "as_pac_server": true
}
OK: listen at localhost:65010
commented

You seems specified wrong parameter remote_host , it should be the real proxy server address. For example: -remote_host example.com

If you specify as_pac_server true, you should know your original pac URL, for example: http://example.com/a/b/c.pac, then you can use http://localhost: 65010/a/b/c.pac after you run this tool.

good luck.

thanks for your reply.
if i need to specify the real proxy server address for -remote_host, where do i specify my original PAC address ?

commented

You do not need to specify your original PAC address, this tool does not care, it just maps

http://localhost: 65010/ANY_PATH/any.pac to
http://example.com/ANY_PATH/any.pac

maybe i wasn't clear enough.

lets say my PAC file lives on http://pacserver.com/any.pac which doesn't require proxy authentication (transparent), but the PAC file sends all requests to a different proxy server which requires auth. how do i work with this ?

commented

You mean nested authentication. Unfortunately the -as_pac_server true does not resolve this case.

You should

  1. Modify the pac file, replace every address behind "PROXY ..." with localhost:someport
  2. Create several proxy-login-automator with password and -local_port someport
  3. Present it with a local web server,
npm install -g http-server
http-server

It will serves current folder as a web as http://127.0.0.1:8080

Finally, your local proxy config should refer http://127.0.0.1:8080/modified.pac

good luck

thanks

so for which situation is the -as_pac_server true made ? when the PAC server itself requires authentication ?

commented

Oh, sorry every much, i was wrong, -as_pac_server true is for both PAC server and child proxy server. This tool does solve the nest authentication problem, but the password must be same.

commented

If the user/password are same for PAC server and child proxy server, then you do not need modify PAC file and create proxy server separately, you can just specify -as_pac_server true

commented

Of course, for PAC or child proxy server which does not need password, the user/password injected by this tool is harmless, do not worry.