Skip to content

Commit 55d7c6b

Browse files
committed
update docs
1 parent 89f05ef commit 55d7c6b

2 files changed

Lines changed: 37 additions & 18 deletions

File tree

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,44 @@
1+
# Reverse proxy for local big-file testing that exercises the shared rendering
2+
# process without requiring TLS.
3+
#
4+
# The shared rendering feature (HTTP2_SHARED_RENDERING_PROCESS_ENABLE) reuses a
5+
# single pspdfkitd worker checkout across multiple tile requests that arrive as
6+
# HTTP/2 streams on the same Cowboy connection. The worker is cached in the
7+
# Cowboy connection process's dictionary, so multiplexing matters: requests on
8+
# the same HTTP/2 connection share a worker, requests on separate connections
9+
# do not.
10+
#
11+
# TLS is not needed for this to work. Caddy's h2c reverse_proxy uses Go's
12+
# http.Transport, which maintains a pool of HTTP/2 connections to the upstream
13+
# and multiplexes requests as streams onto them — regardless of whether the
14+
# browser-to-Caddy leg is HTTP/1.1 or HTTP/2. Multiple browser HTTP/1.1
15+
# requests are funnelled onto a single h2c upstream connection, giving Cowboy
16+
# the HTTP/2 stream multiplexing it needs.
17+
#
18+
# Non-tile traffic (uploads, dashboard, API) stays on HTTP/1.1 upstream to
19+
# avoid Cowboy's HTTP/2 reset-rate guard on large request bodies.
120
{
2-
auto_https off
21+
auto_https off
322
}
423

524
:5000 {
6-
request_body {
7-
max_size 50GB
8-
}
25+
request_body {
26+
max_size 50GB
27+
}
928

10-
# Match the tile-rendering route that needs an upstream HTTP/2 hop to exercise the shared rendering process code path.
11-
@render_tiles path_regexp render_tiles ^/i/d/[^/]+/h/[^/]+/page-.*
29+
# Match the tile-rendering route that needs an upstream HTTP/2 hop to exercise the shared rendering process code path.
30+
@render_tiles path_regexp render_tiles ^/i/d/[^/]+/h/[^/]+/page-.*
1231

13-
handle @render_tiles {
14-
reverse_proxy h2c://document-engine:5000
15-
}
32+
handle @render_tiles {
33+
reverse_proxy h2c://document-engine:5000
34+
}
1635

17-
handle {
18-
reverse_proxy http://document-engine:5000 {
19-
transport http {
20-
versions 1.1
21-
response_header_timeout 15m
22-
}
23-
}
24-
}
36+
handle {
37+
reverse_proxy http://document-engine:5000 {
38+
transport http {
39+
versions 1.1
40+
response_header_timeout 15m
41+
}
42+
}
43+
}
2544
}

document-engine/de-docker-compose/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Caddy is configured to:
8484
- Proxy `/i/d/.../h/.../page-*` tile-rendering requests upstream over HTTP/2
8585
- Keep all other upstream requests on HTTP/1.1 with `response_header_timeout 15m`
8686

87-
The example still exposes the dashboard at `http://localhost:5000/dashboard`. That is intentional: the special HTTP/2 requirement applies to the upstream Caddy-to-Document-Engine hop for tile rendering, which is configured with cleartext HTTP/2 (`h2c`). If you also want browser-to-Caddy HTTP/2, the stack would need to switch to local HTTPS instead of the current `auto_https off` setup.
87+
The dashboard is exposed at plain `http://localhost:5000/dashboard`. TLS is not needed: Caddy's h2c reverse proxy uses Go's `http.Transport`, which multiplexes incoming HTTP/1.1 requests onto a single upstream HTTP/2 connection. This gives Document Engine the HTTP/2 stream multiplexing it needs to reuse a single rendering worker across concurrent tile requests.
8888

8989
## API usage examples
9090

0 commit comments

Comments
 (0)