feat: support HTTPS targets and Anthropic /v1/messages format - #1
Open
SamirSaidani wants to merge 2 commits into
Open
feat: support HTTPS targets and Anthropic /v1/messages format#1SamirSaidani wants to merge 2 commits into
SamirSaidani wants to merge 2 commits into
Conversation
Enables Cache Hunter to proxy and capture traffic to remote HTTPS endpoints such as api.anthropic.com, in addition to local HTTP targets. - Add `targetScheme: 'http' | 'https'` to ProxyEngineConfig and StoredProxyConfig; persisted in proxy-config.json with http fallback for backward compatibility - Route outbound proxy requests through https.request when scheme is https; fix Host header to match target (was leaking localhost:PORT) - Strip query string from stored request path so hash grid path matching is not broken by params like ?beta=true - Add TARGET_SCHEME env var; NODE_EXTRA_CA_CERTS set in start scripts for system CA trust; rejectUnauthorized:false on outbound HTTPS agent (local dev tool, user controls the proxy) - Parse Anthropic /v1/messages format in parseRequestBody: normalise system field (string or content-block array), map thinking.budget_tokens to reasoningEffort, use startsWith for all path matching - Extend SQL filters to LIKE patterns for backward compat with DBs that stored paths with query strings - Frontend: add http/https <select> in config edit form; display full scheme://host:port in header - 128 tests passing, 0 TypeScript errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
targetScheme: 'http' | 'https'config field (env:TARGET_SCHEME), persisted inproxy-config.jsonwith'http'fallback for backward compatibilityhttps.requestwhen scheme ishttps; fixHostheader to match target (was leakinglocalhost:PORT, breaking Cloudflare/SNI routing)pathto avoid hash grid breakage from params like?beta=true; extend SQL filters toLIKEpatterns for backward compat with existing DBs/v1/messagesformat: normalisesystemfield (string or content-block array), mapthinking.budget_tokenstoreasoningEffort, usestartsWithfor all path matchingNODE_EXTRA_CA_CERTSin start scripts for system CA trust; userejectUnauthorized: falseon outbound HTTPS agent (local dev tool)http/https<select>in config edit form; displayscheme://host:portin headerAlso proposes adding an explicit MIT license, consistent with the openfox project.
Usage with Anthropic / Claude Code
Test plan
npm run test:run— 128 tests passingnpx tsc --noEmit— 0 TypeScript errorsapi.anthropic.com/v1/messagesrequests display correctly in hash grid UI