Unclear What the redirect check does, and whether CLAUDE_CODE_DISABLE_REDIRECT_CHECK turns it off, is not stated.
What
A redirect is a server's reply telling the program to send its request somewhere else. Networks that ask you to sign in first, such as hotel or office Wi-Fi, and some proxies redirect traffic this way. Claude Code now checks for this on the requests it sends to the model:
- Model API requests that send data (POST requests) and set no redirect option of their own are now retried with
redirect: error. An unexpected redirect goes to a handler that either follows it or stops withClaude Code refused a redirect of this request. Before, redirected responses were only logged after the fact and never blocked. - A refused redirect now has its own error code,
RedirectRefused, and its own message:Unable to connect to API: sign in to network or proxy. The request was redirected. The message then asks you to have your network administrator allow api.anthropic.com. Before, this case fell through to the genericUnable to connect to APImessage. - The new environment variable
CLAUDE_CODE_DISABLE_REDIRECT_CHECKturns the check off. An environment variable is a named value set in your shell before Claude Code starts. Only the environment Claude Code starts with, your own settings or managed settings (settings an administrator sets for an organisation) may set it, so Claude itself cannot. It joins the same list of names asAWS_ENDPOINT_URL_STSandCLAUDE_CODE_DISABLE_EARLY_KEY_GUARD. - The check that decides whether an error is a sign-in problem now also requires an HTTP 401 status, the server's "not authorised" reply.
Why
A redirect could send model requests, along with your credentials, to a different server. Requests are now stopped instead. If you are behind a sign-in page or proxy, the error now tells you what to do. If the check gets in the way on your network, you can set CLAUDE_CODE_DISABLE_REDIRECT_CHECK.
What the redirect check does, and whether `CLAUDE_CODE_DISABLE_REDIRECT_CHECK` turns it off, is not stated.