pac4cli
pac4cli copied to clipboard
listen on, say, 127.0.1.1:3128 instead of 127.0.0.1 to avoid conflicts with squid and other proxies
This also what dnsmasq and systemd-resolved do.
I think the better approach is to leave 127.0.0.1 as the default. And later we can support having an /etc/pac4cli/conf that can override this behavior.
I was reminded of this issue when I noticed that curl
will resolve the proxy at localhost
as [::1]
when passing the -6
flag:
curl -vvv 'https://www.infty.nl/' -6
* Trying ::1...
* TCP_NODELAY set
* connect to ::1 port 3128 failed: Connection refused
Whereas this works:
https_proxy=http://127.0.0.1:3128 curl -vvv 'https://www.infty.nl/' -6 > /dev/null
* Trying 127.0.0.1...
* TCP_NODELAY set
* allocate connect buffer!
* Establish HTTP proxy tunnel to www.infty.nl:443
> CONNECT www.infty.nl:443 HTTP/1.1
That probably means that even if we keep 127.0.0.1
, we do need to swap out the hostname localhost
by the address 127.0.0.1
in the environment variables we set.
I think the better approach is to leave 127.0.0.1 as the default. And later we can support having an /etc/pac4cli/conf that can override this behavior.
Happy to be convinced, but it's not clear to me why you think that is the better approach?
That probably means that even if we keep 127.0.0.1, we do need to swap out the hostname
localhost
by the address127.0.0.1
in the environment variables we set.
It is possible to listen to both IPv4 and IPv6 interfaces. By that, localhost will always be resolved to an interface that we listen to. Is my understanding correct here?
I think the better approach is to leave 127.0.0.1 as the default. And later we can support having an /etc/pac4cli/conf that can override this behavior.
Happy to be convinced, but it's not clear to me why you think that is the better approach?
Let me rephrase; it is a personal preference to use 127.0.0.1
as the default. This is because 127.0.0.1
is a historical convention, and I don't prefer deviating from conventions as a default. I'd let it to the user to alter the config if he/she needs.
I created a ticket for the IPv6 interface issue. As it is a separate issue than this one.