external connections not working on port 80
I have a java program listening on 0.0.0.0 port 80 but external connections are not getting through.
Here we see that the program is listening to port 80 for any IP:
sudo ss -tulpn | grep LISTEN
tcp LISTEN 0 50 0.0.0.0:80 0.0.0.0:* users:(("java",pid=2660,fd=65))
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=534,fd=3))
tcp LISTEN 0 50 127.0.0.1:46815 0.0.0.0:* users:(("java",pid=2660,fd=63))
tcp LISTEN 0 511 127.0.0.1:45901 0.0.0.0:* users:(("node",pid=830,fd=18))
tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=534,fd=4))
Running telnet from my ssh shell I get:
telnet localhost 80
Trying ::1…
Trying 127.0.0.1…
Connected to localhost.
Escape character is '^]'.
sdfsdf
HTTP/1.1 400 No URI
Content-Type: text/html;charset=iso-8859-1
Content-Length: 49
Connection: close
Server: Jetty(9.4.48.v20220622)Bad Message 400 reason: No URI Connection closed by foreign host.
Which shows that the java program is correctly listening on port 80.
But when I try to connect from my local computer I get:
telnet 176.58.115.27 80
Trying 176.58.115.27…
telnet: connect to address 176.58.115.27: Operation timed out
telnet: Unable to connect to remote host
6 Replies
But when I try to connect from my local computer I get:
Is your firewall set up correctly? Does it allow inbound/outbound traffic on port 80 (it needs to allow both). Does
telnet 176.58.115.27 80
work from your Linode? If it doesn't, that almost certainly nails the problem down to your firewall…
-- sw
This works fine from my linode:
telnet 176.58.115.27 80
Trying 176.58.115.27...
Connected to 176.58.115.27.
Escape character is '^]'.
sdasda
HTTP/1.1 400 No URI
Content-Type: text/html;charset=iso-8859-1
Content-Length: 49
Connection: close
Server: Jetty(9.4.48.v20220622)
Bad Message 400 reason: No URI Connection closed by foreign host.
I didn't set up a firewall and it is my understanding that all ports are normally open except for mail ports.
You mean a firewall on my local machine? I doubt very much that port 80 is blocked as port 80 is the port for http.
You mean a firewall on my local machine? I doubt very much that port 80 is blocked as port 80 is the port for http.
Yes…and I wouldn't make that assumption at all…
I tried your experiment from:
- my Linode at the Fremont, CA datacenter; and
- my laptop in Portland, OR
and got the same results as you (ping works from both places though).
I did find this:
https://askubuntu.com/questions/30917/how-to-make-jetty-webserver-listen-on-port-80
Maybe it will be of some help…
-- sw
Still cannot connect externally to port 80 of my linode host. I can telnet from my ssh shell to the server both on the IP address and localhost but cannot connect remotely.
Strangely if I put the same code in a docker container then I can connect remotely to port 80 (the http port).