Repository navigation
fix: align completions request headers with FE 0.3.19 (fixes #184) - #185
Merged
Rfym21 merged 1 commit intoOct 18, 2026
Merged
Conversation
The web frontend (0.3.17+) hard-requires `Version: 0.3.19` and an `Authorization: Bearer <token>` header on /api/v2/chat/completions. This proxy was still sending `version: 0.2.81` with no Bearer header, causing Bad_Request then Unauthorized. Bump the pinned frontend version and add the Bearer header next to the cookie assembly (both header-profile branches). Fixes Rfym21#184.
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.
Problem
After the chat.qwen.ai frontend upgrade to 0.3.17+,
POST /api/v2/chat/completionsfails — first
Bad_Request, thenUnauthorized— while login / token refresh /POST /api/v2/chats/newall keep working (#184).Root cause
Reverse-engineered from the live 0.3.19 frontend bundle (
main.js, requestinterceptor
eXwhich wraps every request including streams):Version: 0.3.19(capital V) on every request.This proxy pins
version: 0.2.81inheader-profile.js. The stale versionexplains
Bad_Request— and matches the reporter's experiment (0.2.81 →Bad_Request, 0.3.17 → gets one step further).Authorization: Bearer <accessToken>on every requestexcept
/auths/refresh. This proxy never sends it (auth relied on thetoken=cookie alone), which explains the remainingUnauthorized.Notably, the 0.3.19 bundle contains no HMAC request signing at all
(the HMAC strings in
main.jsare just the bundled sha256 library), and the__baxia__token is only used by its own captcha polling — it never enters therequest pipeline. So this is a stale-headers bug, not an anti-bot arms race.
Changes
src/utils/header-profile.jsQWEN_WEB_VERSION = '0.3.19'constant (with a comment noting it musttrack the live frontend — it moved 0.3.17 → 0.3.19 within 3 days).
'version': '0.2.81'→'Version': QWEN_WEB_VERSIONin both the legacyand fingerprint branches.
Authorization: Bearer <token>next to the cookie assembly in bothbranches (only when a token is present).
src/utils/request.js— update staleFE 0.2.81comments toFE 0.3.19.Verification
No live Qwen account was available for an end-to-end test, so I verified at
the header level: ran the proxy locally against a mock upstream that records
received headers.
Before the fix, upstream received:
version: 0.2.81, noauthorizationheader.After the fix, upstream receives:
Version: 0.3.19,Authorization: Bearer <jwt>— matching what the 0.3.19frontend sends.
Follow-ups (not in this PR)
Timezoneheader format differs (UTC+08vs the frontend's full Datestring). Left untouched — not implicated by the reporter's experiments.
given how fast it moves.