You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Is fetch API planned to support unix domain socket? #2970
Many Node.js applications leverage Unix Domain Sockets for inter-process communication (IPC), providing a more efficient and secure way to communicate compared to traditional network sockets. Supporting the socketPath option in undici's fetch API could significantly benefit applications that rely on IPC, especially those dealing with microservices or local server communication.
it would be incredibly useful to have fetch requests directed to a Unix Domain Socket. This could look something like:
Unlikely. We are only doing web spec stuff. If you are doing backend development why are you using fetch? Use undici.request and then you can use unix sockets.
Unlikely. We are only doing web spec stuff. If you are doing backend development why are you using fetch? Use undici.request and then you can use unix sockets.
Because the fetch API is familiar to most developers, we also use the same API as the web on the server side.
Reacted by Dave Mittner, Adrien and Philippe Aubertin
If adding an option to fetch is problematic for some reason, how about just handling requests to unix:// in Deno itself, forwarding the request to the socket? To avoid name resolution/SNI issues, users could include an explicit Host header with their request that would need to be evaluated prior to dispatching.
I know this isn't really elegant from the implementation perspective, but it'd solve the problem now without any API changes necessary, and works just like people would expect it to.
I'm surprised (and disapointed) that undici doesn't support, in an easy way, unix sockets.
As suggested by @JerrysShan, having the ability to use fetch('unix://...') would be really great, pretty simple to implement and easy to use. It would also avoid to add undici as an external dependency.
This is something I would expect from Node.js fetch implementation.
Activity
ronag commentedon Mar 18, 2024
Unlikely. We are only doing web spec stuff. If you are doing backend development why are you using fetch? Use
undici.requestand then you can use unix sockets.JerrysShan commentedon Mar 18, 2024
Because the fetch API is familiar to most developers, we also use the same API as the web on the server side.
mcollina commentedon Mar 18, 2024
I think supporting this should be easy enough and possibly just having the request pass the validation check.
@KhafraDev wdyt?
KhafraDev commentedon Mar 18, 2024
I'm not opposed to it, as long as it doesn't add an option to fetch
KhafraDev commentedon Mar 20, 2024
in the meantime, you can use Agent with fetch
as a sidenote this is actually how people seem to fetch unix sockets in deno
Radiergummi commentedon Sep 8, 2024
If adding an option to fetch is problematic for some reason, how about just handling requests to
unix://in Deno itself, forwarding the request to the socket? To avoid name resolution/SNI issues, users could include an explicitHostheader with their request that would need to be evaluated prior to dispatching.I know this isn't really elegant from the implementation perspective, but it'd solve the problem now without any API changes necessary, and works just like people would expect it to.
Bacto commentedon Sep 9, 2025
Hi,
I'm surprised (and disapointed) that undici doesn't support, in an easy way, unix sockets.
As suggested by @JerrysShan, having the ability to use
fetch('unix://...')would be really great, pretty simple to implement and easy to use. It would also avoid to addundicias an external dependency.This is something I would expect from Node.js fetch implementation.
Hope we could see that one day.
Adrien
Wrap dev/build in db tunnel and run vite dev under Bun