chrome – Display Webpage with Unix Domain Socket

browserchromehttptcpunix-sockets

Is there a way to serve a webpage from a locally running tcp server listening on a unix domain socket instead of localhost:<port>?

something like:

file:///tmp/webpage.sock

my only real motivation is to avoid port conflicts in the 2000-5000 range.

Best Answer

Yes

It is easy to serve it.

No

But harder to get the client to use it.

An alternative

However because you told me why you are doing it, I have another solution.

You want several web-servers to serve to only the local machine, but not have conflicts of port. It may also be nice if they all used the same port number.

Loopback addresses are 127.0.0.0/8 That is 127.x.x.x not just 127.0.0.1.

Therefore use a different IP address for each server. E.g. 127.0.0.2, 127.0.0.3 ...

Related Question