4 ms·
“It turns out both nginx and Apache have the ability to proxy traffic to a Unix domain socket rather than to an HTTP port, which makes this a useful mechanism f
by leephillips 5y ago
“It turns out both nginx and Apache have the ability to proxy traffic to a Unix domain socket rather than to an HTTP port, which makes this a useful mechanism for running backend servers without attaching them to TCP ports.”
That’s one useful nugget of information! I had no idea.
- rogerdonut 5y agoHAProxy can as well (as well as listen on unix sockets)
- moderation 5y agoAnd Envoy Proxy (with an example [0]) 0. https://gist.github.com/moderation/5d9c5352842ca068781f367a6e5f2a39 https://gist.github.com/moderation/5d9c5352842ca068781f367a6...
- colek42 5y agosocat is the tool for this. No need for a full blown webserver.
- RedShift1 5y agosocat is a "dumb" tool. With a proxy that understands HTTP you have a lot more influence over what goes where and for example not direct requests to a down backend instance.
- colek42 5y agoAre you challenging me to build a socat loadbalancer in bash? In all seriousness, I concur. But if you just need to redirect some data streams socat is a rock solid and simple solution.
- jsjohnst 5y ago> Are you challenging me to build a socat loadbalancer in bash? It’s a Saturday and all, so yeah, I’m challenging you (for fun, not because I don’t think it’s possible).
- marcosdumay 5y agoFrom a quick read of the manpage, I don't think it's possible either, unless you mess with EXEC or create multiple listeners to a single address. Anyway, the Linux kernel does have a builtin loadbalancer in the form of shared sockets that you can socat outside of the machine. But I wouldn't call that a socat loadbalancer.
- phoyd 5y agoNow Docker should provide some way to bridge container ports to UDS. That would be perfect.
- TechBro8615 5y agoYou can bind mount the socket in a volume. You can also do this with named volumes shared between containers. You’ll need to make sure the GID/UIDs match, but it works great. It’s often faster for inter service communication than the Docker proxy.
- yrro 5y agoQuick hack for you: socat TCP-LISTEN:4000,fork UNIX-CONNECT:/run/yoursock
- z3t4 5y agoOn webide.se (free shell and web IDE) I use unix sockets alot!, for example nginx proxy from https://foo.user.webide.se https://foo.user.webide.se to /home/user/socket/foo so that users can test their apps using HTTPS/SSL as many browser features need a httpS URL to work. Unix sockers are also used for accessing a shared mySQL server, and an x11 server so you can test out "native" apps and run Android emulator in the browser.
- girishso 5y agoTIL
- deleted 5y ago[deleted]
- nerdponx 5y agoUnfortunately and annoyingly not all applications support listening on Unix domain sockets.