The proxy secret in the tunnel
Redirect rebuilding places proxy credentials inside a request visible to the destination server.
What’s going wrong
A proxied client authenticates correctly on plain HTTP. After an HTTPS redirect it also exposes the proxy credential to the origin server. Repair the channel where credentials are attached, not just their spelling.
Stdin JSON has headers (an application-header object), proxies (map from proxy IDs to synthetic nonempty credential tokens or null), and hops (ordered objects with url and proxy, where proxy is a configured ID or null for direct). URLs use lowercase http/https schemes and valid ASCII hosts. Header names use their canonical spelling; Proxy-Authorization may appear as stale session data. No other authentication header is supplied. Tokens are opaque demonstration strings, not actual secrets. Each hop rebuilds from the caller-owned headers without mutating them and strips stale Proxy-Authorization first.
For HTTP through a proxy, put its token in the proxy-facing request; that proxy consumes the header, so the destination does not receive it. For HTTPS through a proxy, authenticate only the CONNECT tunnel setup: never put the proxy token in the encrypted application request, which the proxy cannot inspect. Direct routes and proxies with a null token attach no proxy credentials.
Print {"hops":[...],"headers":original_headers}. Each hop records scheme, proxy, request (application request headers), connect (tunnel setup headers), and destination (headers seen by the origin). For HTTP, connect is empty; for HTTPS, destination equals request. Ordinary application headers survive every route. No network traffic is performed.
Expected behavior
Assign credentials to the correct transport recipient while preserving caller data through route changes.
Reproduction
{"headers":{"X-Trace":"x"},"proxies":{"p":"DEMO-P","q":"DEMO-Q","n":null},"hops":[{"url":"https://service.example/path","proxy":"p"}]}{"hops":[{"scheme":"https","proxy":"p","request":{"X-Trace":"x"},"connect":{"Proxy-Authorization":"DEMO-P"},"destination":{"X-Trace":"x"}}],"headers":{"X-Trace":"x"}}{"headers":{"X-Trace":"x"},"proxies":{"p":"DEMO-P","q":"DEMO-Q","n":null},"hops":[{"url":"http://service.example/path","proxy":"p"}]}{"hops":[{"scheme":"http","proxy":"p","request":{"X-Trace":"x","Proxy-Authorization":"DEMO-P"},"connect":{},"destination":{"X-Trace":"x"}}],"headers":{"X-Trace":"x"}}{"headers":{"X-Trace":"x"},"proxies":{"p":"DEMO-P","q":"DEMO-Q","n":null},"hops":[{"url":"https://service.example/path","proxy":null}]}{"hops":[{"scheme":"https","proxy":null,"request":{"X-Trace":"x"},"connect":{},"destination":{"X-Trace":"x"}}],"headers":{"X-Trace":"x"}}Before you begin
- Build on redirect state and replay ownership: changing transport changes which layer owns sensitive metadata.
- Python strings, lists and dictionaries
- Read the report contract before changing code
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.