macchiato-framework / macchiato-core

Ring style HTTP server abstraction for Node.js
MIT License
377 stars 35 forks source link

Add IPC (UNIX/Windows domain socket) listener support #46

Closed malyn closed 3 years ago

malyn commented 3 years ago

This change makes it possible to host Macchiato-based services on IPC (aka "UNIX domain") sockets. You can then use something like Nginx to do SSL termination, auth, etc. before proxying requests to the Node.js process. That already works today with TCP-based HTTP sockets, but that approaches exposes the TCP port on the local machine, whereas UNIX sockets can be controlled with filesystem ACLs.

I tested this change on Linux with an Nginx frontend and confirmed that WebSockets work as well. Existing HTTP(S) functionality is unchanged.

Lastly, I chose to set the handler scheme to :http when using the :ipc protocol (as opposed to allowing that as an additional option) since my assumption is that the IPC listener will only ever be used when there is a front-end host that is managing the actual HTTP(S) connection.

yogthos commented 3 years ago

Awesome, thanks for the PR! I just pushed out 0.2.20 with the fix to Clojars.