Commit 4073dcd
committed
fix(proxy): route Codex subscription /backend-api/* catchall to chatgpt.com
Codex CLI in subscription mode polls /backend-api/wham/usage, fetches
agent identity JWKS from /backend-api/wham/agent-identities/jwks, and
hits other auxiliary /backend-api/* endpoints during startup. The HTTP
catchall in _select_passthrough_base_url ignored ChatGPT auth and
routed all unmatched paths to api.openai.com, which 404s on every
backend-api path. Codex interprets that as "session invalid" and
refuses subscription auth.
Add a single branch at the top of _select_passthrough_base_url: when
_resolve_codex_routing_headers reports ChatGPT auth (explicit
ChatGPT-Account-Id header or JWT with chatgpt_account_id claim), return
https://chatgpt.com so the catchall forwards to the right host.
No-op for Anthropic (x-api-key, no JWT), Gemini (x-goog-api-key, no
JWT), OpenAI API key (sk- tokens fail JWT decode), and explicit-route
OpenAI passthroughs (/v1/embeddings, /v1/moderations, etc. don't go
through the catchall). Only behavior change is the targeted unblock for
subscription Codex.1 parent 2e9f52f commit 4073dcd
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
0 commit comments