CLAUDE_CODE_DISABLE_REDIRECT_CHECK

Updated by

CLAUDE_CODE_DISABLE_REDIRECT_CHECK turns off the redirect check on model requests to api.anthropic.com, which follows only a 307 or 308 redirect to the same host. Default: off, so the check runs where a server-side flag enables it. It follows up to 5 same-host hops and refuses any other redirect with "Claude Code refused a redirect of this request". It covers POST requests to api.anthropic.com only, not a gateway set in ANTHROPIC_BASE_URL. Values: 1, true, yes or on (case-insensitive) turns the check off; 0, false or any other value keeps it. Set it in the shell, ~/.claude/settings.json or managed settings; a plugin hooks module cannot set it. Added between v2.1.326 and v2.1.331 and still present in v2.1.332. It is not in the official reference.

StatusPresent in v2.1.332
AddedAdded between v2.1.326 and v2.1.331
Defaultoff, so the check runs where a server-side flag enables it. It follows up to 5 same-host hops and refuses any other redirect with "Claude Code refused a redirect of this request". It covers POST requests to api.anthropic.com only, not a gateway set in ANTHROPIC_BASE_URL
Values1, true, yes or on (case-insensitive) turns the check off; 0, false or any other value keeps it. Set it in the shell, ~/.claude/settings.json or managed settings; a plugin hooks module cannot set it
CategoryFeature toggles
Official docsNot listed
Checked againstv2.1.332

How to set it

For one session, export it in the shell that starts Claude Code:

export CLAUDE_CODE_DISABLE_REDIRECT_CHECK=1
claude

1 lets model requests through a network proxy that answers api.anthropic.com with a redirect to another host.

To apply it to every session, add it to the env object of a settings file:

// ~/.claude/settings.json
{
  "env": {
    "CLAUDE_CODE_DISABLE_REDIRECT_CHECK": "1"
  }
}

Related variables

Frequently asked questions

What does CLAUDE_CODE_DISABLE_REDIRECT_CHECK do?

Turns off the redirect check on model requests to api.anthropic.com, which follows only a 307 or 308 redirect to the same host.

What is the default value of CLAUDE_CODE_DISABLE_REDIRECT_CHECK?

Off, so the check runs where a server-side flag enables it. It follows up to 5 same-host hops and refuses any other redirect with "Claude Code refused a redirect of this request". It covers POST requests to api.anthropic.com only, not a gateway set in ANTHROPIC_BASE_URL.

What values does CLAUDE_CODE_DISABLE_REDIRECT_CHECK accept?

1, true, yes or on (case-insensitive) turns the check off; 0, false or any other value keeps it. Set it in the shell, ~/.claude/settings.json or managed settings; a plugin hooks module cannot set it.

Which Claude Code version has CLAUDE_CODE_DISABLE_REDIRECT_CHECK?

Added between v2.1.326 and v2.1.331 and still present in v2.1.332.

How do I set CLAUDE_CODE_DISABLE_REDIRECT_CHECK?

Export it before starting Claude Code (export CLAUDE_CODE_DISABLE_REDIRECT_CHECK=1), or add it to the "env" object in ~/.claude/settings.json to apply it to every session. 1 lets model requests through a network proxy that answers api.anthropic.com with a redirect to another host.

All variables, searchable: Claude Code environment variables.