Skip to content

feat(server): add opt-in gzip and WebSocket compression config#933

Closed
efiten wants to merge 1 commit intoKpa-clawbot:masterfrom
efiten:feat/compression-config
Closed

feat(server): add opt-in gzip and WebSocket compression config#933
efiten wants to merge 1 commit intoKpa-clawbot:masterfrom
efiten:feat/compression-config

Conversation

@efiten
Copy link
Copy Markdown
Contributor

@efiten efiten commented Apr 30, 2026

Summary

  • Adds a compression config block to config.json (both fields default to false)
  • compression.gzip: true — wraps the HTTP handler with a gzip middleware; compresses API responses and static assets when the client sends Accept-Encoding: gzip. WebSocket upgrade requests are passed through unmodified
  • compression.websocket: true — enables permessage-deflate on the gorilla WebSocket upgrader

Motivation

Operators running behind a reverse proxy that does not compress upstream responses (e.g. nginx proxying to the Go server over a separate network leg) get no compression today. This adds an opt-in way to compress at the source.

Usage

"compression": {
  "gzip": true,
  "websocket": true
}

Test plan

  • TestCompressionConfigDefaults — nil config returns false for both helpers
  • TestCompressionConfigExplicitFalse — explicit false returns false
  • TestCompressionConfigEnabled — explicit true returns true
  • TestGZipMiddlewareCompresses — response is valid gzip when Accept-Encoding: gzip
  • TestGZipMiddlewareSkipsNoAcceptEncoding — plain response when no header
  • TestGZipMiddlewareSkipsWebSocket — WebSocket upgrade not compressed
  • Existing test suite passes unchanged (zero-arg NewHub() calls untouched)

🤖 Generated with Claude Code

Adds a `compression` config block (disabled by default) to let operators
enable HTTP gzip and WebSocket permessage-deflate when sitting behind a
reverse proxy that does not already compress upstream responses.

  "compression": { "gzip": true, "websocket": true }

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@efiten
Copy link
Copy Markdown
Contributor Author

efiten commented Apr 30, 2026

Duplicate of #934 which includes the e2e fix for the detached-element race.

@efiten efiten closed this Apr 30, 2026
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.

1 participant