Repository navigation
Conversation
|
On my system, this results in lots of errors from angular.js, and a weird alien-looking URL. Is there really not an IPv6 hostname equivalent to localhost? |
|
Hmm. |
Binding to all interfaces opens up an unnecessary attack surface and alarms users of netstat -lt. The iterative binding hack is also ugly Instead, just bind to (::1, 0) and read off the assigned ephemeral port and aim the web browser at http://localhost6:PORT/. This may cause issues on systems without working IPv6 loopback. The current code was already broken on systems without IPv6, so I don't expect this to be a problem in practice. If it ends up being problematic, it wouldn't be too hard to fall back to IPv4.
|
I updated the PR with the localhost6 variant. |
|
Sadly, I keep getting bogged down in implementation details, so let me state what I think the goal here is: With the original implementation shipped in 2.0.0 and 2.1.0, we bound to In 6d74978, the bind address was changed to In 44b35f7, the bind address was changed to The changes in this PR change the bind address to Binding to the Really the best thing to do is to bind to both |
|
@ridiculousfish, can you post the angularjs error messages? Given the lack of standardization of Alternatively, it wouldn't be that hard to make this thing create two listening sockets. |
|
Correction: having two listening sockets is a PITA -- they might end up with different ports. Another option would be to do |
|
angular/angular.js#2864 tracks the problem with angularJS. As it stands, I don't think we can take this patch for 2.1.1; I don't want to ship a new release of AngularJS in a point release even if it did work. I considered reverting 44b35f7 (and reopening #1324) to take us back to 6d74978 to possibly fix #673, but I think the attack surface is relatively small and the code is quite simple. Unless there is a demonstrated problem with the existing code I will not be merging this for now, but I appreciate the work that's gone into it and I agree that architecturally it's the best solution, so perhaps we can review it in the future. |
|
(cc @anders @g--n from the other pull requests/issues) |
|
Would the approach of binding to whatever localhost resolves to work? That shouldn't require an AngularJS upgrade. |
|
I think supporting IPv6 only is ugly. If you want to listen on localhost while still supporting both address families, I believe the only way is to set up two listening sockets, one on 127.0.0.1 and one on ::1. This is of course not as neat/simple as the current solution (hack?). Limiting it to IPv6 only will lead to problems as there are many (broken, imo) systems out there that don't have IPv6 enabled/compiled in. (edit again: just realized that listening on :: would break on these systems as well ...) The IPv6 equivalent to localhost is "localhost". It should be both ::1 and 127.0.0.1. "localhost6" is not something standard. @zanchey: bindv6only is not common, but even if it was: I believe those systems do support IPv6 and ::1 will work fine. It was defined for a while by default in Debian, but they stopped doing that years ago... |
|
To clarify: I was just going to pick the highest priority hit (IPv4, or
|
|
Supporting only one is not that nice either, tbh |
|
Why does it matter? If the browser is going to try IPv6 for localhost, then supporting IPv6 should be all that's needed. If the browser is going to try IPv4, then supporting IPv6 is pointless, since it won't get used. |
|
Sorry, this has become outdated. If you are still interested, please comment and I'll reopen. |
Binding to all interfaces opens up an unnecessary attack surface and
alarms users of netstat -lt. The iterative binding hack is also ugly
Instead, just bind to (::1, 0) and read off the assigned ephemeral
port. Then aim the web browser at http://[::1]:PORT/.
This may cause issues on systems without working IPv6 loopback.
The current code was already broken on systems without IPv6,
so I don't expect this to be a problem in practice. If it ends
up being problematic, it wouldn't be too hard to fall back to
IPv4.