Is "localhost" not supposed to point to localhost? I have several applications on my device that can run HTTP servers. I can access the server just fine if I user the actual private IP address, but localhost, 127.0.0.1, and [::1] all fail to access the server. Before you ask, the port and protocol are both correct since I use them in accessing my device's server through its private IP address. Why won't this work? How do I get it to work?
Localhost won't work because the server app that you're using is not configured to listen localhost network interface. I even doubt that the http server (web server) you're using has capabilities  to listening on the loopback interface. Thus you need to be using private IP address instead (on the network interface i.e wifi, ethernet, etc) .

In fact as discussed by Firelord and Irfan, you'd need to be using a real, dedicated webserver application that has the ability to listen on all network interfaces. Then bind the server to the localhost (or loopback interface)


  Additionally if you are using localhost, resolvers may or may not
  resolve that to 127.0.0.1 if it's not explicitly mentioned in
  /etc/hosts