|
| 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. |
1 | 20 | { |
2 | | - auto_https off |
| 21 | + auto_https off |
3 | 22 | } |
4 | 23 |
|
5 | 24 | :5000 { |
6 | | - request_body { |
7 | | - max_size 50GB |
8 | | - } |
| 25 | + request_body { |
| 26 | + max_size 50GB |
| 27 | + } |
9 | 28 |
|
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-.* |
12 | 31 |
|
13 | | - handle @render_tiles { |
14 | | - reverse_proxy h2c://document-engine:5000 |
15 | | - } |
| 32 | + handle @render_tiles { |
| 33 | + reverse_proxy h2c://document-engine:5000 |
| 34 | + } |
16 | 35 |
|
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 | + } |
25 | 44 | } |
0 commit comments