Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it support changing network connections #5

Open
erenoglu opened this issue Feb 2, 2020 · 5 comments
Open

Does it support changing network connections #5

erenoglu opened this issue Feb 2, 2020 · 5 comments

Comments

@erenoglu
Copy link

erenoglu commented Feb 2, 2020

Hi, I was wondering if proxy-pac-proxy supports changing environments.

For example, I will start proxy-pac-proxy with a PAC url, which will work while I'm at work.
But when I go home, how will it behave? In such case, does proxy-pac-proxy simply act as a forwarding proxy directly to the destination host without forwarding any traffic to an upstream proxy? (as none would be defined, since no PAC would be reachable when I'm at home).

@erenoglu
Copy link
Author

erenoglu commented Feb 2, 2020

I just checked it, it does not support. So I started the proxy-pac-proxy with the PAC url, it worked when I was in my corporate network. Once I changed network to one that does not need a proxy, proxy-pac-proxy stopped serving connections, my browser showed "ERR_TUNNEL_CONNECTION_FAILED" error.

Could this feature be added to dynamically adapt if the PAC file can't be reached anymore?

@emarock
Copy link
Owner

emarock commented Feb 3, 2020

The URL of the .pac file is passed at start time via a CLI option or through an environment variable. Once the file is retrieved and parsed, it is not checked again, nor I think it should be. Detection of network and/or configuration changes is better handled at a different level; for example, on Mac platforms an Automator script could take care of restarting proxy-pac-proxy with the proper parameters whenever a network change occurs.

@erenoglu
Copy link
Author

erenoglu commented Feb 3, 2020

Thanks @emarock , I was hoping that once I start prox-pac-proxy, it would then run seamless regardless of network changes. Just like browsers who work with a PAC even if you change networks.
I am roaming between office & home, using proxy-pac-proxy with some linux apps which dont support PAC but have hard coded proxy address to proxy-pac-proxy. They stop working when I reach home.
So unless such feature could be added, it means I will need to restart the service somehow with different configuration file.
Hope it would support starting w/o pointing to any PAC.

@emarock
Copy link
Owner

emarock commented Feb 3, 2020

Unfortunately PAC discovery could be quite intricate and is very platform-dependent, so it is kept out of scope for proxy-pac-proxy, but could be implemented quite easily on top of it for a scenario like yours (i.e. in a if-up.d script).

On a side note, is there any specific reason why you hardcoded the URL to the PAC file rather than setting it as a env variable (or a cli option in an alias, or something like that..)?

@erenoglu
Copy link
Author

erenoglu commented Feb 3, 2020

Actually I dont need PAC discovery. It's much more simpler:
A) If proxy-pac-proxy can't anymore reach destination proxy, it would try direct connection to requested host.
B) If the requested host is not reachable, then proxy-pac-proxy would try to read a PAC file.

In my scenairo, one of A or B would certainly work, and if both wont work, then it means I have another problem which I can configure proxy-pac-proxy to tackle with (ie a different network with a different PAC).

To answer your question, its simple to start the service from upstart deamon with a PAC url parameter than fiddling with Environment variables in service context (for me), but I guess I could also do that, it to set and unset a variable. In any case, I need to restart the service, and that is what I'm trying to avoid as it's difficult.

PS1. I alreayd have a semi-working model with stopping/starting with new config using tinyproxy.
PS2. I'm trying this on a Chromebook to help my linux apps connect to internet, no ifplugd here in sandard setup (but I did compile one for myself)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants