Claude Code “403 Attention Required! | Cloudflare” Error: VPN, Proxy and Network Fixes

Claude Code “403 Attention Required! | Cloudflare” Error: VPN, Proxy and Network Fixes

The Claude Code 403 Cloudflare error reads Failed to authenticate. API Error: 403 Attention Required! | Cloudflare, and it is a network block rather than a login problem.

Your request was refused at the edge of the network, before Anthropic’s API ever read it. The short fix: turn off your VPN or switch its server, then try again. If you are not on a VPN, try a different network such as a phone hotspot, and check that no proxy setting or leftover ANTHROPIC_BASE_URL value is sending your requests the wrong way.

Running /login again will not clear it, and neither will reinstalling. The words after 403 are simply the title of a block page that something on the path sent back instead of an answer. Change the path your request takes and the error goes away.

This guide is part of our help series. Browse all our Claude Code tutorials for more fixes and how-tos.

Tested with Claude Code v2.1.325 on macOS on November 16, 2026. A live block depends on the network you are on and can’t be triggered on demand, so we reproduced the exact message by pointing Claude Code at a small test page on our own Mac that answers with a 403 and the same page title.

The causes and fixes come from Anthropic’s official network and error docs, and each section says which is which. We tested on macOS; the Windows and Linux steps follow Anthropic’s official instructions.

Claude Code 403 Cloudflare Error: Quick Summary

QuestionShort answer
What is it?A 403 block page returned by the network in front of the API, not by the API itself
Is my account the problem?Almost never. The request did not get far enough for your account to matter
Most likely causeA VPN, a proxy, or a network whose address is being refused
First fixTurn the VPN off or change its server, then send a short test prompt
Second fixSwitch networks, for example to a phone hotspot
Work network fixSet HTTPS_PROXY and ask IT to allow Anthropic’s hosts
Does /login help?No. Signing in again sends the request down the same blocked path
Does Claude Code retry?Not in our test: it failed once, in about one second
Diagram showing a Claude Code request passing through your network and being stopped with a 403 block page at the Cloudflare edge before it reaches the Claude API
The request is stopped on the way to the API. Claude Code can only report the status code and the title of the page it got back.

What “403 Attention Required! | Cloudflare” Means

A 403 is the web’s way of saying “I understood you, and the answer is no.” The part that confuses people is the rest of the line. “Attention Required! | Cloudflare” is not an Anthropic message at all.

Anthropic’s API is reached through Cloudflare, a network service that sits in front of many websites. We checked this from our own terminal: a plain request to api.anthropic.com came back with a server: cloudflare header. When that front door refuses a visitor, it answers with a web page, and the wording in this error matches that page’s title.

Claude Code expects the API to reply in JSON, a structured format made for programs. When it gets a web page instead, it has very little to work with. Anthropic’s error reference explains what it does next: it shows the status code and the page’s title.

Claude Code error reference with the paragraph highlighted that says an HTML error page is shown as the status code and the page's title
Anthropic’s error reference: when something answers with an HTML page, the message is the status code plus that page’s title.

The same paragraph has a useful detail for older installs: before v2.1.281, Claude Code dropped the status code when the page had a title. So an old version may show the Cloudflare page title with no 403 in front of it, and it is the same problem.

The text after the number is a page title, not a diagnosis. Read it as “something answered with a web page instead of the API.”

Why it says “Failed to authenticate”

Claude Code treats a 403 as a sign-in failure, because a real 403 from the API usually is one. That is why the line opens with “Failed to authenticate” even though your login is fine. Our login error fixes guide covers the cases where the account really is the cause.

There is a quick way to tell the two apart. A true account 403 comes with an API message, such as API Error: 403 Request not allowed. A network block comes with a page title, such as the Cloudflare one here.

We Reproduced the Exact Error Message

To see how Claude Code builds this line, we wrote a tiny test server on our Mac. It answers every request with a 403 and a web page that carries the same Cloudflare title as the error. Then we pointed Claude Code at it with a throwaway test key, inside a demo folder.

Terminal showing Claude Code v2.1.325 printing Failed to authenticate. API Error: 403 Attention Required! | Cloudflare against a local test page, and a second run printing 403 Just a moment
Claude Code v2.1.325 against our local test pages. The first box is the exact error; the second run used a page with a different title and the message changed to match.

The output matched the reported error word for word. When we changed only the page title to “Just a moment…”, the message changed with it. That confirms what the docs say: Claude Code is repeating a title, and the title tells you who answered.

Two more things stood out. The failure took about 1.2 seconds, and our test server logged a single message request, so Claude Code did not retry it in this test. Waiting it out will not help the way it can with a server error.

To be clear about scope, this was our own test page, not Cloudflare. It shows how the message is formed, not why a real network blocked you. The causes below come from Anthropic’s docs.

Why a Claude Code 403 Cloudflare Block Happens

Anthropic’s docs point at the same short list of suspects every time a request fails on the way to the API: the VPN, the proxy, the firewall and the region. Here is how each one leads to a 403.

CauseWhat is going onWhere it comes from
VPNYour requests leave from the VPN’s address, and that address is refusedError reference lists a VPN that blocks api.anthropic.com as a common cause
Proxy or network filterA device on a work or school network blocks or rewrites the requestInstall troubleshooting: a 403 is usually a proxy or network filter
RegionClaude Code is not offered where your connection appears to beInstall troubleshooting links the supported countries list
Leftover settingsA stale proxy variable or ANTHROPIC_BASE_URL sends requests somewhere elseError reference, under Unable to connect to API
Claude Code install troubleshooting page with the lines highlighted that say a 403 is usually a proxy or network filter or a region limit, and to try a VPN or alternative network
Anthropic’s troubleshooting page on what a 403 usually means: a proxy or network filter, or a region where Claude Code isn’t available.

Notice that a VPN shows up on both sides. If you are in a supported country, a VPN can cause the block. If the network you are on is the restricted one, the docs suggest trying a VPN or another network to get around it.

How to Fix the Claude Code 403 Cloudflare Error

Work through these in order and stop as soon as a short test prompt gets a real reply. The first two take under a minute.

Ladder diagram of five fixes for the Claude Code 403 Cloudflare error: VPN, another network, proxy variables, work network allowlist, supported countries
The five fixes in the order worth trying them, quickest first.

Fix 1: Turn off the VPN or switch its server

Disconnect the VPN, open a new terminal and run a short prompt. If Claude Code answers, the VPN’s address was the problem. If you need the VPN on, pick a different server or location in its app and test again.

Some VPN apps let you exclude certain apps or addresses from the tunnel. If yours does, leaving the terminal or Anthropic’s hosts outside the tunnel keeps the VPN for everything else. This step follows the docs’ list of causes; we did not test individual VPN products.

Fix 2: Try another network

Connect your computer to a phone hotspot and run the same prompt. This is the fastest way to learn whether the block belongs to the network or to your machine.

If it works on the hotspot, your usual network is filtering the request. At home, that points at the router or the internet provider. At work or school, go to Fix 4.

Fix 3: Check proxy variables and ANTHROPIC_BASE_URL

Old settings are easy to forget. A proxy variable from a past job, or an ANTHROPIC_BASE_URL left over from trying a gateway, quietly sends every request somewhere other than Anthropic.

env | grep -i proxy
echo $ANTHROPIC_BASE_URL

On Windows PowerShell, the docs give echo $env:ANTHROPIC_BASE_URL for the second check. Both commands should print nothing unless you set those values on purpose.

Terminal showing no proxy variables, an empty ANTHROPIC_BASE_URL and a short Claude Code prompt that returns ok with exit code 0
A clean result on our Mac: no proxy variables, no custom API address, and a short prompt that gets a real reply.

If something does print, the error reference says to remove it from your shell profile or settings and start Claude Code from a new terminal. Also look inside the env block of your settings files, since the same values can live there. Our guide to environment variables shows where each one can be set.

Claude Code error reference with the step highlighted about checking whether ANTHROPIC_BASE_URL is set in the shell or in settings files
The error reference on leftover ANTHROPIC_BASE_URL values: check the shell and the env block of your settings files.

Fix 4: On a work network, set the proxy and ask IT to allow the hosts

Many offices require all traffic to pass through a company proxy. If Claude Code doesn’t know about it, requests take a path the network refuses. The network docs say Claude Code respects the standard proxy variables.

export HTTPS_PROXY=https://proxy.example.com:8080

Ask your IT team for the real address. Set it before you launch Claude Code, because the docs note that shell variables are read once at startup. One limit to know: Claude Code does not support SOCKS proxies.

Claude Code network configuration page with the proxy environment variables code block highlighted, showing HTTPS_PROXY, HTTP_PROXY and NO_PROXY
The proxy variables Claude Code reads, from the network configuration page.

To make it stick, put the same value in the env block of ~/.claude/settings.json. The docs say every variable on that page can be set there.

{
  "env": {
    "HTTPS_PROXY": "https://proxy.example.com:8080"
  }
}

Then send IT the list of hosts Claude Code needs. For sign-in and everyday requests, the key ones are api.anthropic.com, claude.ai, claude.com and platform.claude.com. The full table is on the network configuration page.

Network access requirements table in the Claude Code docs with the api.anthropic.com and platform.claude.com rows highlighted
The hosts Claude Code must reach. Share this table with your network team.

Fix 5: Check supported countries, then contact support

If every network gives you the same block and nothing is set on your machine, check Anthropic’s supported countries list. The docs name region as the other usual reason for a 403.

If you are in a supported country and still blocked on a clean network, that is the point to contact Anthropic support. Include the full error line and the network you were on.

How to Confirm the Network Path Is Clean

You don’t have to guess whether a fix worked. The error reference gives one command to test whether you can reach the API host from the same shell.

curl -I https://api.anthropic.com

On Windows PowerShell, use curl.exe -I https://api.anthropic.com so the built-in alias is not used. We added one more check of our own that makes the result easier to read: ask for the messages address and look at what comes back.

curl -s https://api.anthropic.com/v1/messages
Terminal showing api.anthropic.com answering with a server cloudflare header and a JSON error, next to a local test page answering with HTML titled Attention Required! | Cloudflare
On a healthy connection the API answers in JSON, even for a bare request. An HTML page, like our test page at the bottom, means something else answered.

On our Mac the reply was a small JSON error saying “Method Not Allowed”. That sounds bad, but it is good news: it is the real API talking. If you see HTML with a block page title instead, you are still blocked, and Claude Code will be too.

Claude Code error reference with the curl check for api.anthropic.com and the HTTPS_PROXY step highlighted
The official checks: reach the API host with curl, and set HTTPS_PROXY if you are behind a corporate proxy.

When curl works but Claude Code still fails

The error reference covers this case too. It suggests checking ANTHROPIC_BASE_URL first, as in Fix 3. On macOS, it adds that a VPN you disconnected or removed can leave a tunnel or routing rule behind, and that container tools such as Docker Desktop can intercept outgoing traffic.

If the request never connects at all, you will see a different message. Our connection error guide covers ConnectionRefused, ECONNRESET and timeouts.

Related 403 Messages in Claude Code

Not every 403 is this one. The text after the number tells you which fix applies.

MessageWhat it meansWhere to look
403 Attention Required! | CloudflareA block page answered instead of the APIThis guide: VPN, proxy, network
403 Request not allowedThe API refused the account after loginSubscription status or Console role
403 with another page titleA different proxy or gateway answered with its own pageThe device named in the title
Gateway refused the requestYour company’s Claude gateway said noYour gateway administrator
Claude Code troubleshooting page section titled 403 Forbidden after login with the Behind a proxy line highlighted
The docs’ section on a 403 after login. Even for the account version of the error, a proxy is on the list.

For a wider list of messages and what each one means, see our roundup of common errors. If you suspect an outage rather than a block, a Claude status check takes a few seconds.

Try It Yourself

Run this after each change you make. It sends one tiny request and prints the result, so you know right away whether the path is clear.

claude -p "reply with the single word ok"; echo "exit code: $?"

A reply of “ok” and an exit code of 0 means you are through. If the 403 line comes back with exit code 1, move to the next fix on the list.

Common Mistakes

  • Running /login over and over. The login is not what was refused, so a fresh one changes nothing.
  • Reinstalling Claude Code. The block sits on the network, outside the app.
  • Setting a proxy variable in a terminal while Claude Code is already running. It only reads shell variables at startup, so restart it.
  • Using a SOCKS proxy address. Claude Code does not support SOCKS, so use an HTTP or HTTPS proxy.
  • Testing in a browser only. The Claude AI website loading in your browser does not prove the terminal takes the same path, especially with a per-app VPN or proxy.
  • Writing retry loops in scripts. In our test the failure was instant and not retried, so a loop just repeats the block.

Pro Tips

  • Read the words after the number first. A page title means a network device answered; an API sentence means the API did.
  • Run /status inside Claude Code to see the Proxy row. The docs say it shows the active proxy URL and flags a value it can’t parse.
  • Start with claude --debug when a proxy or certificate setting doesn’t seem to apply. The debug log shows what loaded.
  • Keep proxy settings in ~/.claude/settings.json rather than a shell profile if you use background agents. The docs note that shell exports don’t reliably reach them.
  • Update Claude Code. Since v2.1.281 the message keeps the status code next to the page title, which makes this error much easier to recognize.
  • For other status codes, our guide to API error 400 and 500 explains which ones are worth retrying.

Cheat Sheet

Cheat sheet for the Claude Code 403 Attention Required Cloudflare error with five checks and five fixes
The checks and fixes on one card.

Frequently Asked Questions

Is my Claude account banned if I see 403 Attention Required! | Cloudflare?

No. This message is a block page from the network in front of the API, and it is tied to where your request came from, not to your account. An account problem shows an API message after the number instead of a page title.

Why does Claude Code say “Failed to authenticate” for a network block?

Claude Code treats a 403 status as a sign-in failure, because that is what a 403 from the API normally means. It can’t see inside the block page, so it reports the status code and the page’s title. We confirmed this with a local test page in v2.1.325.

Will logging in again fix the Claude Code 403 Cloudflare error?

No. A new login travels the same blocked path. Fix the path first by changing the VPN, the network or the proxy setting, and your existing login will work again.

Does Claude Code work with a VPN?

It can, but Anthropic’s error reference lists a VPN that blocks api.anthropic.com as a common cause of connection failures. If you hit this error with a VPN on, turn it off or switch servers and test again.

What should I ask my IT team for?

Ask for the company proxy address to put in HTTPS_PROXY, and ask them to allow the hosts in Anthropic’s network access table, starting with api.anthropic.com, claude.ai, claude.com and platform.claude.com. The network configuration page has the full list to forward.

Conclusion

The Claude Code 403 Cloudflare error is a network block wearing a login error’s clothes: a block page answered instead of the API, and Claude Code printed the status code and that page’s title. Turn off or switch the VPN, try another network, clear stale proxy and ANTHROPIC_BASE_URL values, and on a work network set HTTPS_PROXY and get Anthropic’s hosts allowed. Confirm with a short test prompt after each change, and check the official error reference and troubleshooting guide if a different message appears.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top