解决使用Proxifier代理python.exe后导致某些应用程序启动失败的方法

运行后,错误提示大概如下

The above exception was the direct cause of the following exception:

Traceback (most recent call last):  
File "F:\heygem-win-50\app.py", line 4, in <module>  
main()  
File "cy_app.py", line 550, in cy_app.main  
File "cy_app.py", line 544, in cy_app.start_gradio  
File "F:\heygem-win-50\py39\lib\site-packages\gradio\blocks.py", line 2780, in launch  
resp = httpx.get(  
File "F:\heygem-win-50\py39\lib\site-packages\httpx_api.py", line 195, in get  
return request(  
File "F:\heygem-win-50\py39\lib\site-packages\httpx_api.py", line 109, in request  
return client.request(  
File "F:\heygem-win-50\py39\lib\site-packages\httpx_client.py", line 825, in request  
return self.send(request, auth=auth, follow_redirects=follow_redirects)  
File "F:\heygem-win-50\py39\lib\site-packages\httpx_client.py", line 914, in send  
response = self._send_handling_auth(  
File "F:\heygem-win-50\py39\lib\site-packages\httpx_client.py", line 942, in _send_handling_auth  
response = self._send_handling_redirects(  
File "F:\heygem-win-50\py39\lib\site-packages\httpx_client.py", line 979, in _send_handling_redirects  
response = self._send_single_request(request)  
File "F:\heygem-win-50\py39\lib\site-packages\httpx_client.py", line 1014, in _send_single_request  
response = transport.handle_request(request)  
File "F:\heygem-win-50\py39\lib\site-packages\httpx_transports\default.py", line 249, in handle_request  
with map_httpcore_exceptions():  
File "F:\heygem-win-50\py39\lib\contextlib.py", line 153, in **exit**  
self.gen.throw(typ, value, traceback)  
File "F:\heygem-win-50\py39\lib\site-packages\httpx_transports\default.py", line 118, in map_httpcore_exceptions  
raise mapped_exc(message) from exc  
httpx.RemoteProtocolError: Server disconnected without sending a response.

造成这个错误的原因是因为IPV6

更新 Localhost 规则以包含 IPv6

这是解决问题的最直接、最正确的方法。

1. **打开 Proxifier 规则设置** (Profile -> Proxification Rules...)。
    
2. **双击编辑您那条名为 Localhost 的规则**。
    
3. 在 Target Hosts 字段,将原来的内容:  
    localhost; 127.0.0.1; %ComputerName%
    
    **修改为 (在末尾添加 ::1):**  
    localhost; 127.0.0.1; %ComputerName%; ::1
    
    (分号后面可以有空格也可以没有,为了清晰建议加上)
    
4. 点击 OK 保存规则。
    
5. 确保这条 Localhost 规则仍然在列表的最顶端。
    
6. 点击 OK 保存所有规则。
    
7. **完全关闭并重新运行您的 Python 脚本。**
    

修改后的规则将能够正确匹配 IPv6 的本地回环地址,并让它直连,从而彻底解决 Gradio 本地通信被错误代理的问题。

增加一个 ::1

20251117150844.png

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

5 + 2 =