Closed Bug 31510 Opened 21 years ago Closed 18 years ago

Proxy: localhost and should be proxyable, but not by default


(Core :: Networking, defect, P3)






(Reporter: bbaetz, Assigned: benc)




(2 files, 1 obsolete file)

I've been trying out PSM with the latest CVS build.

Clicking on the padlock icon doesn't work because it tries to connect to
http://3@ but this gives me a connection refused error from
the proxy.

I'm using manual proxies since autoproxy doesn't work yet, and didn't have
localhost, listed in the "No proxies for" section. Once I add this,
then it works fine.

I've checked that trying http://{localhost,} tries to go through the
proxy, so its not a PSM problem.

This could be resolved as user error, but if PSM relies on this then I think it
should be the default.
Adding myself to keep me in the loop.
As far as localhost going through a proxy - I think it should. Netscape 4.X does
this, and if I have my proxy on localhost and/or properly set up then I *want*
localhost to go through the proxy server - especially if I'm using it as some
sort or debugging tool. So, I think this portion of the bug is wontfix or
invalid, which I think the reporter already new - but was just pointing out to
show what is causing problems with the PSM stuff. :)

As far as the PSM stuff going through the proxy - yeah, bad!
marking a duplicate of bug 31164.

*** This bug has been marked as a duplicate of 31164 ***
Closed: 21 years ago
Resolution: --- → DUPLICATE
verified DUP
+qawanted - need to verify behavior in something recent link M0.9.
change summary for searchability.
The duped bug isn't really a dupe.

Joe's point is very good, send everything to the proxy, and use "no proxy" if 
you do not want it to.

If "no proxy" has bugs (and it does), comment here and we'll mark a depends.
Keywords: qawanted
Resolution: DUPLICATE → ---
Summary: localhost and should not go through the proxy → Proxy: localhost and should be proxyable
qa to me.
-> new
Ever confirmed: true
QA Contact: tever → benc
Bug 80848, might make it so you cannot get out of proxying "localhost".
Target Milestone: --- → mozilla1.0
Well, I filed this originally, but I can't remember what I was thinking :) It
was mainly PSM bug IIRC - I shouldn't have had to avoid proxying to localhost if
I wasn't expecting to connect there.

A current branch build does allow localhost to be proxied.
*** Bug 88261 has been marked as a duplicate of this bug. ***
+mostfreq  <wow, this is really annoying people...>
Keywords: mostfreq
*** Bug 86449 has been marked as a duplicate of this bug. ***
I don't see how you can make them proxyable - what if your proxy is on another
server ? IMHO, there should simply be a default entry in 'No proxy for' of, localhost. Then if people *really* want to use a proxy for that
address they can just delete it.
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 
(you can query for this string to delete spam or retrieve the list of bugs I've 
Target Milestone: mozilla1.0 → mozilla1.0.1
localhost, should by default be in the "No Proxy For" field.
This is what most people want, and can be easily changed by the minority.
I think gabriel came up with this idea first, about chaning the defaults.

I've been meaning to make this as my first attempt to patch, but if anyone wants
to do it, go ahead.

I think the idea would be to add the following line to all.js:

pref("network.proxy.no_proxies_on", "localhost,");

Since this is a prefs change, I think this could be done anytime, even for 0.9.7
if someone could come up with a really good reason...
IE has a checkbox 'do not use proxy server for local addresses', by default

I think putting localhost, on do not use proxy for is a better solution.

I've tested a bunch of combinations of no-proxy so that I know I've got the
correct configuration.

And I think I'm making enough progress getting CVS access, installing compilers
and other build/patch stuff where I will actually be able to build the patch and
submit it soon.

Officially, it would be good for someone to volunteer to qa the change as well...
Assignee: gagan → benc
*** Bug 130296 has been marked as a duplicate of this bug. ***
*** Bug 145876 has been marked as a duplicate of this bug. ***
*** Bug 164532 has been marked as a duplicate of this bug. ***
*** Bug 164802 has been marked as a duplicate of this bug. ***
I know this is not the place to start a discussion on this item but I just 
wanted to add the following : is the loopback address, meant for local (same host) access.
'localhost' is a dns entry with is by RFC bound to, the loopback 
The number of people who intend to use address through a proxy is imho very 
small. But the possibility should exist.
'Correct' behaviour would imho be :
As soon as a user enters a proxy/choose auto proxy, should be added 
as a default in the 'no proxy for' so it can still be deleted.
'localhost' should not be added as it is bound to by default.
<i>The ".localhost" TLD has traditionally been statically defined in host DNS 
implementations as having an A record pointing to the loop back IP address and 
is reserved for such use. Any other use would conflict with widely deployed 
code which assumes this use. </i>
Of course overriding this can still be done on OS level.

I would even go as far as to copy the proxy-ip for all entries when the manual 
HTTP proxy is entered; from a user friendly use point of view
localhost has to be included in the fix because we don't do hostname -> IP
conversion when we use the "no proxy" mask, we do a string compare. There is a
bug on this somewhere...
Blocks: 160091
Attached patch patch to all.jsSplinter Review
I've tested this patch to make sure it changes http://localhost and
Okay, I've checked all the dupes, moved the correct ones to Networoking,
verified them all, fixed a couple bad dupes...

Due to limitations in "no proxy for", it might trap or
other hostnames w/ localhost in it.

I also need to check how well manual over-ride works.
Okay, patched phoenix's file. oops. I'll patch the other file soon.

Turns out the behavior is this:

new profiles will show the values by default.
However, if you delete them, they will be replaced by "", and that entry in
prefs.js will never clear, so it is basically a one time seed.
Comment on attachment 101381 [details] [diff] [review]
patch for the mozilla-trunk all.js

that's not a patch!
Attachment #101381 - Attachment is obsolete: true
Comment on attachment 101383 [details] [diff] [review]
patch to all.js for mozilla-trunk


this seems like a reasonable stop-gap measure; although it will do nothing to
help out folks who have modified the no_proxies_on preference in their prefs.js
(via the proxy prefs UI).

ultimately, we need to move some checks into the nsProtocolProxyService to
always disable proxying to localhost.  we might want to pref this check as

also, there's some edge cases that this check will miss.  e.g. "xyzlocalhost"
Attachment #101383 - Flags: superreview+
Summary: Proxy: localhost and should be proxyable → Proxy: localhost and should be proxyable, but not by default
Comment on attachment 101383 [details] [diff] [review]
patch to all.js for mozilla-trunk

Attachment #101383 - Flags: review+
Thanks. I don't have cvs checkin for code, only Is the next step
finding someone to cvs checkin to the trunk?
I know this is late but I object to including "localhost". It is just a
string. By convention it is the name for but that's just a
convention. There's no RFC that requires that linkage. In fact, some
installations handle "localhost" in their DNS servers wher it could refer to
almost anything. This patch is based on what works on some machines not what 
is required for all machines.
Every DNS server that has "" that I have checked maps back

The underlying problem here is that noproxy just checks the URL string, so there
is no "check the IP post DNS resolution" step. If you don't trap "localhost",
you never will.
thanks to sicking for the checkin!
This should be in the trunk before the 1.2 branch, so new profiles in 1.2b and
1.2 should exhibit this as well.
Closed: 21 years ago18 years ago
Resolution: --- → FIXED
Target Milestone: mozilla1.0.1 → mozilla1.2beta

Normally, I would not verify my own fix, but this was just a prefs file change.

Looked only at Mac OS X, creation of new profiles does have pre-populated "no
proxy" entries.
Keywords: qawanted
You need to log in before you can comment on or make changes to this bug.