How to do that?
I’m not sure how it would be done through Phoenix, but I believe you can pass {:local, "/path/to/unix/socket"}
to :cowboy.start_clear()
as a transport option. I haven’t tested this myself, but the docs would lead me to believe that.
https://ninenines.eu/docs/en/cowboy/2.6/manual/cowboy.start_clear/
https://ninenines.eu/docs/en/ranch/2.0/manual/ranch_tcp/
Specifically this from the ranch_tcp docs,
On UNIX systems, it is also possible to use a UNIX Domain socket file by specifying
{local, SocketFile}
.
Yes, you do it like that, also set port to 0.
This thread may be helpful:
Indeed, it is possible like this:
http: [ip: {:local, '/srv/phx/project/development.socket'}, port: 0],
Thanks @entone, @hubertlepicki