Skip to content

Commit e137daf

Browse files
authored
Merge pull request oasisprotocol#2349 from oasisprotocol/amela/docs-rofl-proxy-custom-domains
docs: Document ROFL proxy custom domains
2 parents c54a9ef + 2367827 commit e137daf

File tree

1 file changed

+82
-23
lines changed

1 file changed

+82
-23
lines changed

docs/rofl/features/proxy.mdx

Lines changed: 82 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# Port Proxy
22

3-
Port proxy for your ROFL automatically generates public HTTPS URLs for
4-
services in your app. Simply publish a port in your `compose.yaml` and the
5-
proxy handles TLS certificates and routing.
3+
The ROFL proxy automatically makes your services accessible via public URLs.
4+
Simply publish a port in your `compose.yaml` and the proxy will make sure
5+
the traffic is correctly routed.
66

7-
TLS is terminated inside the app, providing end-to-end encryption so that
8-
even the provider cannot see the traffic.
7+
TLS is required and it is terminated inside your ROFL enclave, providing
8+
confidentiality and integrity protection so that even the provider cannot see or
9+
modify the traffic. The default `terminate-tls` mode will also generate and
10+
configure a Let's Encrypt certificate in ROFL to authenticate your services.
911

1012
## Enabling the Proxy
1113

12-
To expose a port from your container, publish it in
13-
your `compose.yaml` file:
14+
To expose a port from your container, publish it in your `compose.yaml` file:
1415

1516
```yaml title="compose.yaml"
1617
services:
@@ -20,14 +21,15 @@ services:
2021
- "5678:5678" # Expose container port 5678 on host port 5678
2122
```
2223
23-
After deploying your app, you can find the generated URL by
24-
running `oasis rofl machine show`:
24+
After deploying your app, you can find the generated URL by running `oasis
25+
rofl machine show`:
2526

2627
```shell
2728
oasis rofl machine show
2829
```
2930

30-
The output will contain a `Proxy` section with the URL for each published port:
31+
The output will contain a `Proxy` section with the public URL for each
32+
published port:
3133

3234
```
3335
Proxy:
@@ -38,30 +40,87 @@ Proxy:
3840

3941
## Configuration
4042

41-
The proxy behavior can be configured using annotations in
42-
your `compose.yaml` file.
43+
The proxy behavior can be configured using [annotations] in your
44+
`compose.yaml` file.
4345

44-
The annotation key is `net.oasis.proxy.ports.<published_port>.mode`.
46+
[annotations]: https://docs.docker.com/reference/compose-file/services/#annotations
4547

46-
Supported modes are:
48+
### Overview
4749

48-
- `terminate-tls` (default): The proxy terminates the TLS connection and
49-
forwards the unencrypted traffic to your container.
50-
This is suitable for HTTPS services.
51-
- `passthrough`: The proxy forwards the raw TCP connection to your container.
52-
This is suitable for services that handle their own TLS or
53-
use other TCP-based protocols.
54-
- `ignore`: The proxy will ignore this port, and it will
55-
not be exposed publicly.
50+
Each annotation follows this general format:
5651

57-
Example of configuring a port for TCP passthrough:
52+
`net.oasis.proxy.ports.<published_port>.<setting>: <value>`
53+
54+
Where:
55+
56+
- `<published_port>`: The external port exposed in your compose.yaml
57+
- `<setting>`: The specific proxy configuration (e.g., `mode`, `custom_domain`)
58+
59+
### Example Configuration
60+
61+
The following example configures port 80 to use `terminate-tls` mode (the
62+
default) with a custom domain and port 8080 to use TCP `passthrough`.
5863

5964
```yaml title="compose.yaml"
6065
services:
6166
myservice:
6267
image: docker.io/my/service:latest
6368
ports:
69+
- "80:80"
6470
- "8080:8080"
6571
annotations:
72+
net.oasis.proxy.ports.80.custom_domain: mydomain.com
6673
net.oasis.proxy.ports.8080.mode: passthrough
6774
```
75+
76+
What this configuration does:
77+
78+
- The application container exposes ports 80 and 8080.
79+
- On port 80 the proxy terminates TLS for mydomain.com and forwards traffic to
80+
the application container.
81+
- On port 8080 the proxy forwards the raw TCP connection to your application
82+
container (`mode: passthrough`).
83+
84+
### Annotation Reference
85+
86+
#### `net.oasis.proxy.ports.<published_port>.mode`
87+
88+
Defines how the proxy should handle connections for the specified port.
89+
90+
| Mode | Description | Typical Use Case |
91+
| ------------------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------- |
92+
| `terminate-tls` (default) | The proxy terminates TLS and forwards traffic to the container (all within the TEE). | Standard HTTPS web applications. |
93+
| `passthrough` | The proxy forwards raw TCP traffic directly to the container. | Services that handle their own TLS or use other TCP-based protocols. |
94+
| `ignore` | The proxy ignores this port entirely and does not expose it publicly. | Internal or non-public service ports. |
95+
96+
#### `net.oasis.proxy.ports.<published_port>.custom_domain`
97+
98+
Assigns a custom domain name to the published port.
99+
100+
- When using `terminate-tls` mode (the default), you need to use special
101+
configuration for your custom domain to route through the proxy.
102+
103+
After your app is deployed, use the Oasis CLI to obtain instructions to
104+
configure `A` and `TXT` records in your DNS:
105+
106+
```shell
107+
oasis rofl machine show
108+
```
109+
110+
```
111+
Proxy:
112+
Domain: m897.opf-testnet-rofl-25.rofl.app
113+
Ports from compose file:
114+
5678 (frontend): https://demo.rofl.build
115+
* Point the A record of your domain to: 131.153.241.25
116+
* Add a TXT record to your domain:
117+
oasis-rofl-verification=4SKHCn4E2SNDB5tXayQeHZsvH/+kJSNGuQaTAPepYJc=
118+
```
119+
120+
- If you're using `passthrough` mode, the proxy doesn't terminate TLS and your
121+
app needs to handle it directly. In this case, the `custom_domain` setting
122+
is not needed. Instead, configure your domain to point directly to the ROFL
123+
instance's address.
124+
125+
- If you're using `ignore` mode, the port isn't published, so the
126+
`custom_domain` setting has no effect.

0 commit comments

Comments
 (0)