Skip to content

feat(runtime): compress proxied responses by default - #157

Merged
richardsolomou merged 1 commit into
mainfrom
feat/156-proxy-compression
Aug 25, 2026
Merged

feat(runtime): compress proxied responses by default#157
richardsolomou merged 1 commit into
mainfrom
feat/156-proxy-compression

Conversation

@richardsolomou

Copy link
Copy Markdown
Owner

Problem

caddyRealtimeProxy emitted no encode directive and runRealtimeStack wrote the generated config unconditionally, so every dynamic response behind the stack went out uncompressed. praetorium.gg worked around it by composing the config from the exported builder and string-inserting the directive (richardsolomou/praetorium.gg#294), a workaround coupled to the exact text this package emits. Fixes #156.

Changes

The generated site block now opens with encode zstd gzip, on by default since Caddy already skips WebSocket upgrades and incompressible content; encode: false in CaddyRealtimeProxyOptions turns it off. Measured on praetorium: the homepage document went 24 KiB to 6 KiB and its largest JSON payload ~300 KiB to ~61 KiB over the wire.

How did you test this code?

  • pnpm check (format, lint, config, typecheck, 37 tests including a new one asserting the directive is present by default and absent with encode: false, build, package and policy checks, example app check)

The generated Caddy proxy served every dynamic response uncompressed
and offered no hook to change that, so consumers patched the generated
config by hand. An encode directive is now emitted unless turned off.

Fixes #156
@richardsolomou
richardsolomou merged commit fa32841 into main Aug 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

caddyRealtimeProxy offers no way to enable response compression

1 participant