Skip to content

feat: rewrite JS response bodies to route requests through proxy - #97

Merged
yylt merged 1 commit into
mainfrom
feat/js
Aug 18, 2026
Merged

feat: rewrite JS response bodies to route requests through proxy#97
yylt merged 1 commit into
mainfrom
feat/js

Conversation

@yylt

@yylt yylt commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Include text/javascript, application/javascript and application/x-javascript in the body-rewriting branch so hardcoded https:// and // URLs inside JS are routed through the proxy. Skip JS bundles larger than 2 MiB by upstream content-length to avoid buffering huge files; HTML keeps rewriting always.

- JS response body rewriting is now off by default, enabled only when the
  REWRITE_JS secret is set to a truthy value (1/true/yes/on)
- Apply the 2 MiB MAX_REWRITE_BODY cap to HTML as well as JS, so oversized
  HTML pages stream through untouched
- Pass the switch through image_handler and handler call sites
- Document REWRITE_JS in AGENTS.md
- refactor: apply JS rewrite only in the generic proxy
@yylt
yylt merged commit 8c59a16 into main Aug 18, 2026
3 checks passed
@yylt
yylt deleted the feat/js branch August 20, 2026 08:33
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