Score:0

Port 80 not open. Still gets 404 when curl

de flag

Weird issue I'm facing currently! There is nothing running on port 80.

Still curl gives 404 page not found. I can telnet to port 80 and even start a container exposing port 80 (host). But no requests reaches the container!

Any idea what might be going on? How do I debug this?

$ netstat -tulpn | grep :80
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::8000                 :::*                    LISTEN      -                   
$ curl localhost
404 page not found
Matthew Ife avatar
jo flag
Please provide output of `iptables -vnL -t nat` or `nft list ruleset ip` as theres possibly a internal nat redirect causing that behaviour.
de flag
It was indeed because of iptables rule. I had installed k3s which configures some iptables rules. Uninstalling it solved the issue.
Score:1
ao flag

In addition to Matthew's comment suspecting internal nat redirect

  • iptables -vnL -t nat or nft list ruleset ip

perhaps you could directly inspect port 80. These are some of the ways to do that:

  • ss -4tlnp -o state LISTENING '( sport = :80 )'
  • lsof -i:80
  • do a verbose tcpdump
  • do a verbose portscan with nmap
  • or, be even more explicit when testing with curl, ie curl -v http://localhost:80
fr flag
I would add `curl` with `-v` option to the top of this list.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.