Skip to content

Commit 59d1d9c

Browse files
CopilotMossaka
andauthored
docs: add server connectivity guide for HTTP, HTTPS, and gRPC (#179)
* Initial plan * docs: add server connectivity guide for HTTP, HTTPS, and gRPC Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com> * docs: add host.docker.internal section for host-to-guest communication Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
1 parent a667c2a commit 59d1d9c

1 file changed

Lines changed: 114 additions & 0 deletions

File tree

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: Server Connectivity
3+
description: Connect to HTTP, HTTPS, and gRPC servers through the firewall.
4+
---
5+
6+
The firewall controls **outbound** traffic from clients inside awf to external servers. This guide covers connecting to HTTP, HTTPS, and gRPC servers.
7+
8+
## HTTP/HTTPS servers
9+
10+
Clients inside awf can connect to any whitelisted domain over HTTP or HTTPS.
11+
12+
```bash
13+
# Connect to HTTPS server
14+
sudo awf --allow-domains api.example.com -- \
15+
curl https://api.example.com/data
16+
17+
# Connect to HTTP server (non-TLS)
18+
sudo awf --allow-domains 'http://legacy.example.com' -- \
19+
curl http://legacy.example.com/api
20+
```
21+
22+
:::tip
23+
Use `https://` or `http://` prefix to restrict a domain to a specific protocol.
24+
:::
25+
26+
## gRPC servers
27+
28+
gRPC connections work through the firewall when using standard ports.
29+
30+
### gRPC over HTTPS (port 443)
31+
32+
```bash
33+
# gRPC with TLS on standard HTTPS port
34+
sudo awf --allow-domains grpc.example.com -- \
35+
grpcurl grpc.example.com:443 myservice.Service/Method
36+
```
37+
38+
### gRPC-web over HTTP/HTTPS
39+
40+
```bash
41+
# gRPC-web uses standard HTTP/HTTPS ports
42+
sudo awf --allow-domains api.example.com -- \
43+
grpcurl -plaintext api.example.com:80 myservice.Service/Method
44+
```
45+
46+
:::note
47+
The firewall only allows ports 80 (HTTP) and 443 (HTTPS). Non-standard gRPC ports like 50051 are blocked.
48+
:::
49+
50+
## Connecting to host services
51+
52+
Use `host.docker.internal` to connect from inside awf to services running on your host machine:
53+
54+
```bash
55+
# Connect to a server running on the host (e.g., localhost:3000)
56+
sudo awf --allow-domains host.docker.internal -- \
57+
curl http://host.docker.internal:3000/api
58+
```
59+
60+
:::tip
61+
`host.docker.internal` is automatically configured in awf containers and resolves to the host machine.
62+
:::
63+
64+
## Server inside, client outside
65+
66+
To run a server inside awf that accepts external connections, use `--keep-containers` and connect via Docker:
67+
68+
```bash
69+
# Start server inside awf (stays running)
70+
sudo awf --allow-domains example.com --keep-containers -- \
71+
python3 -m http.server 8080 &
72+
73+
# Connect from host using docker exec
74+
docker exec awf-agent curl http://localhost:8080
75+
```
76+
77+
:::caution
78+
The firewall is designed for egress control. For production server hosting, consider running servers outside the firewall.
79+
:::
80+
81+
## Bidirectional communication
82+
83+
A server that accepts requests and makes outbound calls to whitelisted domains:
84+
85+
```bash
86+
# API gateway that proxies to backend
87+
sudo awf --allow-domains backend.example.com --keep-containers -- \
88+
node gateway.js
89+
90+
# Gateway can:
91+
# - Accept connections on its internal port
92+
# - Make outbound requests only to backend.example.com
93+
```
94+
95+
## Debugging connectivity
96+
97+
```bash
98+
# Keep containers running for inspection
99+
sudo awf --allow-domains example.com --keep-containers -- sleep 60
100+
101+
# Test connectivity from inside
102+
docker exec awf-agent curl -v https://example.com
103+
104+
# Check Squid logs for blocked requests
105+
sudo grep "TCP_DENIED" /tmp/squid-logs-*/access.log
106+
107+
# View all traffic
108+
awf logs --format pretty
109+
```
110+
111+
## See also
112+
113+
- [Domain Filtering](/gh-aw-firewall/guides/domain-filtering) - Allowlists, blocklists, wildcards
114+
- [CLI Reference](/gh-aw-firewall/reference/cli-reference) - All options

0 commit comments

Comments
 (0)