claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Domain <X> is not allowed to be fetched even though explicitly allowed

Open yfzhou0904 opened this issue 6 months ago • 4 comments

Environment

  • Platform (select one):
    • [x] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [ ] Other:
  • Claude CLI version: 0.2.125 (Claude Code)
  • Operating System: macos 15.5
  • Terminal: iTerm2

Bug Description

  1. prompt claude code to reference page: https://zod.dev/v4.
  2. claude code ask for permission to fetch this site, since this domain has not been persistently allowed or denied before on my computer.
  3. select "yes" or "yes and don't ask again"
  4. ⏺ Fetch(https://zod.dev/v4)… ⎿  Error: Domain zod.dev is not allowed to be fetched

Expected Behavior

Actual Behavior

Additional Context

yfzhou0904 avatar May 22 '25 01:05 yfzhou0904

Were you able to solve this? We're experiencing the same issue.

awickham10 avatar Jun 10 '25 16:06 awickham10

Were you able to solve this? We're experiencing the same issue.

Are you on the latest claude code version? I regularly use & upgrades claude code, and I haven't seen this problem since I posted the issue. Maybe it's fixed?

yfzhou0904 avatar Jun 10 '25 16:06 yfzhou0904

Ran into it with 1.0.17. Thanks for the quick response!

awickham10 avatar Jun 10 '25 17:06 awickham10

Same problem with 1.0.31 (Claude Code)

$ claude --version
1.0.31 (Claude Code)
$ cluade
> summary this doc  https://docs.anthropic.com/en/docs/claude-code/ide-integrations
  ⎿  Error: Domain docs.anthropic.com is not allowed to be fetched

Image

ahuigo avatar Jun 30 '25 06:06 ahuigo

Hasn't it been fixed yet?

Randomyyds avatar Jul 06 '25 12:07 Randomyyds

Same problem on 1.0.44

Kelvinlby avatar Jul 08 '25 03:07 Kelvinlby

same problem on v1.0.45

toomanyopenfiles avatar Jul 09 '25 05:07 toomanyopenfiles

I pinpointed the issue, when Claude Code ask for permission to fetch the site it adds the permission WebFetch(domain:example.com) but what it needs is Fetch(domain:example.com) so as a temp fix, go to your .claude/settings.local.json change all occurences of WebFetch into Fetch and it should work.

Edit: that will not fix future permissions (i.e. when Claude will want to fetch another site). So I have added Fetch(domain:*) to my list of permission. Seems like a reasonable security tradeoff in my situation.

jstoeffler avatar Jul 09 '25 06:07 jstoeffler

I suspect the WebFetch tool is making a network request to claude.ai which is blocked by my corporate proxy but the corporate proxy docs page only outlines the network access requirements of the following:

Network access requirements
Claude Code requires access to the following URLs:

api.anthropic.com - Claude API endpoints
statsig.anthropic.com - Telemetry and metrics
sentry.io - Error reporting
Ensure these URLs are allowlisted in your proxy configuration and firewall rules. This is especially important when using Claude Code in containerized or restricted network environments.

Chris112 avatar Jul 14 '25 06:07 Chris112

I suspect the WebFetch tool is making a network request to claude.ai which is blocked by my corporate proxy but the corporate proxy docs page only outlines the network access requirements of the following:

Network access requirements
Claude Code requires access to the following URLs:

api.anthropic.com - Claude API endpoints
statsig.anthropic.com - Telemetry and metrics
sentry.io - Error reporting
Ensure these URLs are allowlisted in your proxy configuration and firewall rules. This is especially important when using Claude Code in containerized or restricted network environments.

I think the problem described in this thread is unrelated to the network, as the request is blocked by Claude so it doesn't go through the network. Do you get an error like this:

⏺ Fetch([SOME_URL)…](SOME_URL)%E2%80%A6)
⎿  Error: Domain SOME_DOMAIN is not allowed to be fetched

If yes, can you try to add

Fetch(domain:SOME_DOMAIN)

to your claude.settings and see if it fixes the issue? If not let us know.

If it's a different error I suggest creating a new issue and describing the problem with the error you get there.

jstoeffler avatar Jul 14 '25 12:07 jstoeffler

I suspect the WebFetch tool is making a network request to claude.ai which is blocked by my corporate proxy but the corporate proxy docs page only outlines the network access requirements of the following:

Network access requirements
Claude Code requires access to the following URLs:

api.anthropic.com - Claude API endpoints
statsig.anthropic.com - Telemetry and metrics
sentry.io - Error reporting
Ensure these URLs are allowlisted in your proxy configuration and firewall rules. This is especially important when using Claude Code in containerized or restricted network environments.

I think the problem described in this thread is unrelated to the network, as the request is blocked by Claude so it doesn't go through the network. Do you get an error like this:

⏺ Fetch([SOME_URL)…](SOME_URL)%E2%80%A6)
⎿  Error: Domain SOME_DOMAIN is not allowed to be fetched

If yes, can you try to add

Fetch(domain:SOME_DOMAIN)

to your claude.settings and see if it fixes the issue? If not let us know.

If it's a different error I suggest creating a new issue and describing the problem with the error you get there.

I encountered the same error: Error: Domain SOME_DOMAIN is not allowed to be fetched

In my case, switching between WebFetch and Fetch didn't resolve the issue. However, when I analyzed the traffic through a local web proxy, I discovered that requests were being made to the claude.ai domain (which isn't mentioned in the corporate proxy documentation).

Just wanted to share this finding in case others experience the same issue after trying the WebFetch/Fetch swap - you might need to allowlist claude.ai in your proxy configuration as well.

Chris112 avatar Jul 14 '25 13:07 Chris112

same problem, add Fetch(domain:xx) is not use.

zyoung1212 avatar Jul 16 '25 12:07 zyoung1212

I have the same problem...

santiago-afonso avatar Jul 16 '25 15:07 santiago-afonso

By default, the fetch function in Node.js does not utilize the system environment variables HTTP_PROXY or HTTPS_PROXY. This means that if the domain you are trying to access requires proxy access, Node.js will not use the proxy settings. Below is the official solution to this issue:

https://github.com/nodejs/node/pull/57165

They will introduce an NODE_USE_ENV_PROXY environment variable. When NODE_USE_ENV_PROXY=1, Node.js will parse the HTTP_PROXY and HTTPS_PROXY environment variables upon startup to utilize the proxy settings.

This PR will take effect in Node.js version 24.0.0.

toomanyopenfiles avatar Jul 17 '25 04:07 toomanyopenfiles

same question

Windy3f3f3f3f avatar Jul 18 '25 13:07 Windy3f3f3f3f

> can you visit https://github.com/anthropics/claude-code/issues/1217

● Fetch(https://github.com/anthropics/claude-code/issues/1217)
  ⎿  Error: Domain github.com is not allowed to be fetched

My permissions are:

│ Permissions:  Allow   Deny   Workspace                                                                                                                                                                   │
│                                                                                                                                                                                                          │
│ Claude Code won't ask before using allowed tools.                                                                                                                                                        │
│                                                                                                                                                                                                          │
│ ❯ 1. Add a new rule…                                                                                                                                                                                     │
│   2. Fetch(domain:*)                                                                                                                                                                                     │
│   3. Fetch(domain:*)                                                                                                                                                                                     │
│   4. WebFetch(domain:github.com)

Tried everything mentioned above and it still doesn't work.

Update: I use third party MCP to fetch pages now.

ekexium avatar Jul 22 '25 07:07 ekexium

Adding Fetch(domain:*) won't help. Try Cursor or Gemini cli instead. :-)

jorschac avatar Jul 30 '25 09:07 jorschac

mark,did not work for me either

bikeread avatar Jul 30 '25 15:07 bikeread

This is a bug caused by Claude Code checking Anthropic's api at claude.ai/api/web/domain_info?domain=... before it will fetch pages. On Enterprise networks, the Anthropic API is often blocked.

Unfortunately there is no workaround or flag to disable this undocumented feature.

flaviut avatar Jul 31 '25 12:07 flaviut

In case you happen to be in this enterprise scenario where the https cert is being modified (which was the case for me) and causes node to see it as invalid/unauthorized:

export NODE_TLS_REJECT_UNAUTHORIZED=0

theneverstill avatar Jul 31 '25 18:07 theneverstill

Thanks to @ekexium 's solution, I've created a simple wrapper using Claude Code. You just need to run npm install -g claude-fetch-setup, then execute claude-fetch-setup to set up the customized fetch-mcp. The result is as follows:

> claude code

⏺ I'm ready to help you with your coding tasks. What would you like me to assist with?

> try to visit github.com

⏺ I'll help you visit GitHub.com. Let me fetch the content for you.

⏺ fetch - fetch_html (MCP)(url: "https://github.com")
  ⎿                                


     … +81 lines (ctrl+r to expand)

⏺ I've visited GitHub.com for you. The page has loaded successfully. It's the main GitHub landing page
   with features like:

  - Sign in and sign up options
  - Search functionality for repositories
  - Navigation links to various GitHub features
  - The page supports both light and dark themes

  Is there something specific you'd like to do with GitHub? For example, are you looking to navigate
  to a specific repository, search for something, or perform another action?

For more details, please check the source code repository

pomelo-nwu avatar Aug 05 '25 05:08 pomelo-nwu

This is because Claude Code will request data from Claude.ai instead of the URL you requested. Therefore, you need to configure a proxy for CC to allow it to bypass the local firewall to access Claude.ai. Or you can consider using the MCP provided by @pomelo-nwu .

HWOUq1xd7c avatar Aug 20 '25 13:08 HWOUq1xd7c

@HWOUq1xd7c is right.

When u let cc use WebFetch to visit a website, cc will query LLM then call local WebFetch tool. Before visit the website, cc will request https://claude.ai/api/web/domain_info?domain={website domain} to query if can fetch or not. Most of us will meet a 403 Forbidden response(maybe IP restriction), then cause cc throw error.

So the method is,

  • You can setup a http(s) proxy to cc
  • You can forbid WebFetch and use other MCP tools. Maybe tavily, or refer to @pomelo-nwu said.

retanoj avatar Sep 05 '25 11:09 retanoj

curl 'https://claude.ai/api/web/domain_info?domain=ai-sdk.dev'

It may return:

<!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=Edge"><meta name="robots" content="noindex,nofollow"><meta name="viewport" content="width=device-width,initial-scale=1">...

NOT

{"domain":"ai-sdk.dev","can_fetch":true}

Maybe network check is the key to solve the problem.

sweetcard avatar Sep 27 '25 07:09 sweetcard