Skip to content

Conversation

@cablehead
Copy link
Contributor

corresponding PR: nushell/nushell#16907

@cablehead cablehead marked this pull request as ready for review October 21, 2025 17:40
fdncred pushed a commit to nushell/nushell that referenced this pull request Oct 23, 2025
All `http` commands now support connecting via Unix domain sockets using
the `--unix-socket` flag, enabling communication with local services
like Docker daemon, systemd, and other IPC services.

# Usage

```nu
# Query Docker daemon via Unix socket
http get --unix-socket /var/run/docker.sock http://localhost/containers/json

# POST to a local service
http post --unix-socket ./my-service.sock http://api/endpoint {data: "value"}
```

The URL's hostname is used for the HTTP `Host` header while the
connection goes through the specified socket path.

# Platform support

Unix systems (Linux, macOS, BSD) and Windows!

# Testing

Manually tested, on POSIX only, with a real-world use case:
[xs.nu](https://gist.github.com/cablehead/b853c7f6bea96fab49a66c0352f10574#file-xs-nu-L24-L61)
- a Nushell wrapper for [cross.stream](https://github.com/cablehead/xs)
that uses the new Unix socket support.

# Notes

The `--unix-socket` flag follows curl's design, where it accepts a path
to connect through the Unix domain socket instead of using TCP.

# Documentation

See nushell/nushell.github.io#2059
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant