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
net: Listen on ":80" does not serve from the machines IP address on windows #17467
Comments
Also present on go version go1.7.1 windows/amd64 |
Perhaps it's blocked by your firewall or anti-virus software.
|
I have specifically allowed it in the firewall even though I am testing on the same physical machine. It makes no difference. I can see no specific mention of it in my antivirus settings and would have no reason to suspect that as it will serve it up via the normal machine ip address but only if I specify it fully. i.e. http.ListenAndServe(":80", mux) only works on local host |
Um, is |
/cc @mikioh @alexbrainman |
it seems that it has been edited out because I accidentally used formatting codes. Updated with more clarity. |
If you say this works fine for port 8080 on your machine, but not port 80, then it sounds like something on your machine (firewall, anti-virus, as @minux suggested) is messing with you. I'm pretty sure we already have unit tests for exactly this behavior, but if somebody wants to trybot a unit test in the /cc @odeke-em who might be interested. |
Ok you've won I'll give up and blame the firewall/antivirus and just use a different port. |
Have you already tried to run "netstat -oan" before running your application? I'm not a Windows user and have no Windows box, but when googling "windows+listen+port+80", I can see many articles such as "port 80 is used by system process." Seems like golang-nats or Stack Overflow is the best place for asking questions. |
What version of Go are you using (
go version
)?go1.6.2 windows/amd64
What operating system and processor architecture are you using (
go env
)?set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\ian_n\Documents\Go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GO15VENDOREXPERIMENT=1
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
What did you do?
On windows
mux := http.NewServeMux()
mux.HandleFunc("/ping", ping)
What did you expect to see?
I would expect to be able to browse to http://localhost/ping and http://{ip address}/ping
What did you see instead?
Only the url using localhost worked.
Using a different port such as 8080 both urls work.
Using linux and port 80 both urls work.
The text was updated successfully, but these errors were encountered: