Skip to content

Commit 8bf7a6d

Browse files
committed
.
1 parent b97d470 commit 8bf7a6d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

cookbook/http.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,19 @@ Available metadata:
292292
- `status` - HTTP status code (200, 404, 500, etc.)
293293
- `headers` - `[{name, value}, ...]`
294294
- `urls` - Redirect history
295+
296+
---
297+
298+
### Connecting via Unix Domain Sockets
299+
300+
On Unix systems, you can connect to HTTP servers over Unix domain sockets using the `--unix-socket` flag. This is commonly used for local services like the Docker daemon, systemd, or other IPC services.
301+
302+
```nu
303+
# Query Docker daemon via Unix socket
304+
http get --unix-socket /var/run/docker.sock http://localhost/containers/json
305+
306+
# The hostname in the URL populates the HTTP Host header
307+
http post --unix-socket ./my-service.sock http://api/endpoint {data: "value"}
308+
```
309+
310+
The socket path specifies where to connect, while the URL's hostname is used for the HTTP Host header.

0 commit comments

Comments
 (0)