Fix Authorization header being stripped by proxy
Author: dabberz_ Channel: #Authorization header being stripped Link: https://discord.com/channels/1405685085923049482/1471999396043554868/1472103880056897745
Problem
The Authorization header is being stripped from fetch requests going through the proxy. This appears to be a recent regression.
Context
Multiple users are experiencing this issue:
- API was working fine a few hours ago with no code changes
- The header is present in the browser console but doesn't reach the backend
- Appears to be happening somewhere in the proxy layer (nginx reverse proxy confirms header is sent)
- Workarounds like
X-Auth-Tokenheader work fine - This affects software that requires the Authorization header and cannot use alternative methods
Reproduction
- Install and run http-echo-server:
npm install http-echo-server
PORT=8081 npx http-echo-server
- In browser console, run a fetch request with Authorization header:
let r1 = await fetch("https://example.com:8081/api/v1/my/profile", {
"credentials": "include",
"headers": {
"Authorization": "Bearer eyTest",
"Content-Type": "application/json",
},
"method": "GET"
})
await r1.text()
- Verify the Authorization header is missing from the request received by the backend
Expected Behavior
The Authorization header should be passed through to the backend unchanged.
discord-bug
2 Comments
Thanks, and apologies. Fix is in; waiting for some infra work to wrap up and then will get it deployed ASAP.
Should be fixed now. Apologies again.