Commit 12eb256
authored
Optimize dev proxy upstream performance (#896)
* Streamline the dev proxy guide to match the ts CLI install
Replace the verbose `cargo run --manifest-path … --target … -- dev proxy`
invocations with the installed `ts` binary (via `cargo install-cli`), so the
guide reads the same way as the CLI guide. Note that `ts dev proxy` is
macOS-only and phrase the install step as "install or update".
Make the quick start a complete first run (`ca install`, then run with
`--rewrite-host` and `--launch chrome`), and make `--rewrite-host` the
recommended default for dev and staging upstreams. The Host-header guidance now
turns on whether the upstream accepts `Host: <FROM>` rather than on the upstream
being Trusted Server Compute.
Correct several stale or wrong examples, verified against the CLI source:
- Firefox `certutil` now uses `-d "sql:…"` and the full CA nickname, matching the
auto-import the tool performs.
- Add the missing `--connect-timeout` option and note that `[COMMAND]` is `ca`.
- Prefer `--basic-auth-file` over inline `--basic-auth` in the staging example.
- Clarify the CA key is stored outside the repository only by default, and rename
"First run: CA setup" to "The development CA".
* Address deep-review findings on the dev proxy guide
Keep `--rewrite-host` in the quick start (it is required for upstreams that reject
`Host: <FROM>`), but state its trade-off honestly: against a real Trusted Server
adapter, first-party URLs then render on the upstream host, not the production
domain. Qualify the "first-party URLs always stay on the production domain" claim
accordingly — it holds only when the upstream preserves `X-Forwarded-Host`.
Also:
- Note that Firefox CA auto-import needs `certutil` (`brew install nss`) and
qualify the troubleshooting row that assumed it is always present.
- State that `--launch` opens only the first mapped hostname while every mapping
is still proxied.
- Note that connection options (`--rewrite-host`, auth, `--insecure`,
`--upstream-plaintext`) apply to every mapping, not per-rule.
- Scope the Safari "only while the proxy runs" claim to a clean exit.
* docs: design dev proxy performance optimizations
* docs: tighten dev proxy performance design
* docs: preserve body semantics in retry design
* docs: resolve deep review of proxy performance design
* docs: define early-response pool behavior
* docs: align proxy lease ownership wording
* docs: close final proxy performance design gaps
* docs: define proxy benchmark controls
* docs: plan dev proxy performance optimizations
* Address final dev proxy design review
* Harden dev proxy shutdown design
* Harden dev proxy lifecycle and benchmarks
* Establish dev proxy performance baseline
* Precompute dev proxy upstream identity
* Optimize dev proxy upstream performance
* Harden dev proxy connection lifecycle
* Plan dev proxy review backfill
* Correct dev proxy request outcome metrics
* Use a fresh connection after stale readiness
* Remove rejected HTTP2 origin state
* Cover dev proxy connector configuration
* Backfill dev proxy credential safety tests
* Cover dev proxy streaming failure lifecycles
* Cover forwarding pool isolation and overread
* Backfill adversarial proxy shutdown coverage
* Cover dev proxy pool key isolation
* Complete dev proxy review backfill
* Quiet blind tunnel failures for unmatched hosts
Only unmatched hosts reach the blind tunnel, and real publisher pages
reference many third-party domains that are dead, blackholed, or
DNS-blocked. Logging each failure at warn level drowned out failures on
mapped upstreams, so log them at debug instead. The browser still
receives its 502 and the failure remains visible at debug level.
* Address dev proxy review feedback1 parent 516a827 commit 12eb256
24 files changed
Lines changed: 8536 additions & 321 deletions
File tree
- crates/trusted-server-cli
- src/commands/dev/proxy
- upstream
- tests
- support
- docs
- guide
- superpowers
- implementation-notes
- plans
- specs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
Lines changed: 21 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
738 | 738 | | |
739 | 739 | | |
740 | 740 | | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
741 | 754 | | |
742 | 755 | | |
743 | 756 | | |
| |||
826 | 839 | | |
827 | 840 | | |
828 | 841 | | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
835 | 846 | | |
836 | 847 | | |
837 | 848 | | |
| |||
845 | 856 | | |
846 | 857 | | |
847 | 858 | | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
854 | 863 | | |
855 | 864 | | |
856 | 865 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| |||
152 | 154 | | |
153 | 155 | | |
154 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
155 | 170 | | |
156 | 171 | | |
157 | 172 | | |
| |||
305 | 320 | | |
306 | 321 | | |
307 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
308 | 336 | | |
309 | 337 | | |
310 | 338 | | |
| |||
Lines changed: 148 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
56 | 58 | | |
57 | | - | |
58 | | - | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
63 | 77 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 78 | + | |
| 79 | + | |
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
71 | 83 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
76 | 91 | | |
77 | 92 | | |
78 | 93 | | |
| |||
163 | 178 | | |
164 | 179 | | |
165 | 180 | | |
| 181 | + | |
166 | 182 | | |
167 | 183 | | |
168 | 184 | | |
| |||
171 | 187 | | |
172 | 188 | | |
173 | 189 | | |
| 190 | + | |
174 | 191 | | |
175 | 192 | | |
176 | 193 | | |
| |||
221 | 238 | | |
222 | 239 | | |
223 | 240 | | |
| 241 | + | |
224 | 242 | | |
225 | 243 | | |
226 | 244 | | |
227 | 245 | | |
228 | 246 | | |
229 | 247 | | |
230 | | - | |
| 248 | + | |
231 | 249 | | |
232 | 250 | | |
233 | 251 | | |
234 | 252 | | |
235 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
236 | 257 | | |
237 | 258 | | |
238 | 259 | | |
| |||
243 | 264 | | |
244 | 265 | | |
245 | 266 | | |
246 | | - | |
| 267 | + | |
247 | 268 | | |
248 | 269 | | |
249 | 270 | | |
| |||
281 | 302 | | |
282 | 303 | | |
283 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
284 | 311 | | |
285 | 312 | | |
286 | 313 | | |
| |||
322 | 349 | | |
323 | 350 | | |
324 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
325 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
326 | 360 | | |
327 | 361 | | |
328 | 362 | | |
| |||
367 | 401 | | |
368 | 402 | | |
369 | 403 | | |
370 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
371 | 409 | | |
372 | 410 | | |
373 | 411 | | |
| |||
377 | 415 | | |
378 | 416 | | |
379 | 417 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
385 | 426 | | |
386 | 427 | | |
387 | 428 | | |
| |||
501 | 542 | | |
502 | 543 | | |
503 | 544 | | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
| 545 | + | |
508 | 546 | | |
509 | 547 | | |
510 | | - | |
| 548 | + | |
511 | 549 | | |
512 | 550 | | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
513 | 635 | | |
514 | 636 | | |
515 | 637 | | |
| |||
0 commit comments