claude-code
claude-code copied to clipboard
[BUG] Domain <X> is not allowed to be fetched even though explicitly allowed
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
- prompt claude code to reference page: https://zod.dev/v4.
- claude code ask for permission to fetch this site, since this domain has not been persistently allowed or denied before on my computer.
- select "yes" or "yes and don't ask again"
- ⏺ Fetch(https://zod.dev/v4)… ⎿ Error: Domain zod.dev is not allowed to be fetched
Expected Behavior
Actual Behavior
Additional Context
Were you able to solve this? We're experiencing the same issue.
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?
Ran into it with 1.0.17. Thanks for the quick response!
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
Hasn't it been fixed yet?
Same problem on 1.0.44
same problem on v1.0.45
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.
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 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 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 fetchedIf 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.
same problem, add Fetch(domain:xx) is not use.
I have the same problem...
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.
same question
> 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.
Adding Fetch(domain:*) won't help. Try Cursor or Gemini cli instead. :-)
mark,did not work for me either
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.
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
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
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 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.
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.