ACTIVITY
Timeline
Timeline for the post: Cloudflare Worker strips Authorization header when X-Forwarded-For present causing 401s on API POSTs
Currently licensed under: CC BY-SA 4.0
| When | What | By | License | Comment |
|---|---|---|---|---|
Oct 18, 2026, 9:45:27 AM 1mo ago | Solution accepted | pixelpelle | An answer was marked as the accepted solution. | |
Oct 18, 2026, 9:45:27 AM 1mo ago | Answer | elincode | CC BY-SA 4.0 | First, change the Worker to explicitly forward the Authorization header instead of relying on the fetch to inherit it. In code, build a headers object and set headers['authorization']=request.headers.get('authorization') before calling fetch(new Request(url,{method,headers,body})). Verify by enabling a non-sensitive debug flag that confirms presence (true/false) of Authorization at edge and origin logs. If that fixes it, revert any broad header rewrites. If problems persist, temporarily bypass the Worker or disable WAF rules to isolate Cloudflare policy as the cause; rollback is safe by restoring the prior Worker version or removing the page rule. |
Oct 18, 2026, 9:45:27 AM 1mo ago | Created | pixelpelle | CC BY-SA 4.0 | Cloudflare Worker strips Authorization header when X-Forwarded-For present causing 401s on API POSTs |