We have a Origin Server that sometimes returns 401 Responses. These responses always trigger a 502 error screen from cloudflare side. Is there any way we can change this behaviour so that the 401 response is passed on to the end user ?
Cloudflare doesn’t rewrite 4XX codes - so I wouldn’t expect a 502 to be emitted by us unless your origin actually returned us that error condition.
Can you provide a reproduction? The full output with headers e.g.
curl -svo /dev/null example.com is helpful.