CLAUDE_CODE_DISABLE_REDIRECT_CHECK
Updated by Alex Sorokoletov
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.
| Status | Present in v2.1.332 |
|---|---|
| Added | Added between v2.1.326 and v2.1.331 |
| 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 |
| Category | Feature toggles |
| Official docs | Not listed |
| Checked against | v2.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
claude1 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
CLAUDE_CODE_DISABLE_COMMAND_INJECTION_CHECK: Previously allowed disabling command injection detection.CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECKCLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK: Set to 1 to skip the workspace-trust gate that claude ultrareview added in v2.1.309.CLAUDE_CODE_DISABLE_LAYOUT_CHECKCLAUDE_CODE_DISABLE_REDIRECT_DENY_RECHECKCLAUDE_CODE_DISABLE_ADMIN_ENV_UNION: When set to true, uses only the leading admin tier's environment settings instead of merging (unioning) the environment across all admin tiers.CLAUDE_CODE_DISABLE_ARTIFACTCLAUDE_CODE_DISABLE_ATTACHMENTS: File/image attachments.
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.