Flutter运行Chrome应用报错:Self-referential requests to this proxy server are forbidden
问题:Flutter Web应用启动时Chrome立即关闭,报"Self-referential requests to this proxy server are forbidden"
Launching lib\main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
Unexpected character
403 OK; body:"<HTML><TITLE>Forbidden</TITLE><H1>Self-referential requests to proxy are forbidden</H1>Self-referential requests to this proxy server are forbidden</HTML>" #0 ChromeConnection.getTabs (package:webkit_inspection_protocol/webkit_inspection_protocol.dart:68:11) <asynchronous suspension> #1 ChromiumLauncher._getFirstTab (package:flutter_tools/src/web/chrome.dart:432:11) <asynchronous suspension> #2 ChromiumLauncher.connect (package:flutter_tools/src/web/chrome.dart:408:9) <asynchronous suspension> #3 ChromiumDevice.startApp (package:flutter_tools/src/web/web_device.dart:145:17) <asynchronous suspension> #4 ResidentWebRunner.run.<anonymous closure> (package:flutter_tools/src/isolated/resident_web_runner.dart:304:9) <asynchronous suspension> #5 asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:24) <asynchronous suspension> Finished with error: Unable to connect to Chrome debug port: 64538 Unexpected character 403 OK; body: <HTML><TITLE>Forbidden</TITLE><H1>Self-referential requests to proxy are forbidden</H1>Self-referential requests to this proxy server are forbidden</HTML>
已尝试的无效操作
- 删除Windows环境变量中的
http_proxy、https_proxy和no_proxy - 以管理员身份启动Android Studio
解决方案
1. 检查Chrome独立代理设置
Chrome可能保留了单独的代理配置,不受系统环境变量影响:
- 打开Chrome,输入
chrome://settings/system - 关闭使用代理服务器选项,或确保代理规则中排除本地调试地址(如
127.0.0.1、localhost)
2. 强制Flutter启动无代理Chrome
在终端执行启动命令时添加禁用代理参数:
flutter run -d chrome --no-proxy-server
3. 清除Chrome进程与调试端口残留
- 打开任务管理器,结束所有
chrome.exe相关进程(包括后台进程) - 重启项目或指定新调试端口:
flutter run -d chrome --web-port=8080
4. 重置Chrome默认设置
- 打开Chrome的
chrome://settings/reset - 选择将设置恢复为原始默认值,清除异常插件或代理配置影响
5. 检查用户级环境变量
除系统环境变量外,需确认当前用户的变量设置:
- 右键此电脑 → 属性 → 高级系统设置 → 环境变量
- 在用户变量中删除
http_proxy、https_proxy相关条目,重启电脑后重试
内容的提问来源于stack exchange,提问作者NiTiN
相关产品推荐
相关产品推荐

