gpt4 book ai didi

bash - Curl:绕过本地主机的代理

转载 作者:行者123 更新时间:2023-11-29 08:43:04 30 4
gpt4 key购买 nike

我在代理下,如果我尝试 curl http://localhost/mysitecurl http://127.0.0.1/mysite curl 尝试使用代理解决它。所以我尝试使用 --noproxy 选项,但没有用。对于代理为 curl http://mysite.com 的外部服务器工作正常。

我的配置:

  • Windows 8 下的 Cygwin (bash),带有 curl 扩展。
  • 代理:proxy.domain.xx:1080 无需身份验证
  • http_proxy=http://proxy.domain.xx:1080
  • 本地服务器:XAMP 版本 1.8.0
  • Apache 端口:80,443
  • 浏览器:带代理的 Chrome,但配置为访问 localhost*.dev

来自 curl --help

--noproxy : Comma-separated list of hosts which do not use proxy

我尝试了什么:

  • 我已经停用了防火墙,什么也没有
  • $ curl -v http://localhost/mysite -> 调试:

    响应

    Connected to proxy.domain.xx (200.55.xxx.xx) port 1080 (#0)
    GET http://localhost/mysite HTTP/1.1
    User-Agent: curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8r zlib/1.2.3
    Host: localhost
    Accept: */*
    Proxy-Connection: Keep-Alive
    The system returned: <PRE><I>(111) Connection refused</I></PRE>
  • curl -v --noproxy localhost, http://localhost/muestra

    响应

    About to connect() to localhost port 80 (#0)
    * Trying 127.0.0.1...
    * Connected to localhost (127.0.0.1) port 80 (#0)
    > GET /mysite HTTP/1.1
    > User-Agent: curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8r zlib/1.2.3
    > Host: localhost
    > Accept: */*
    >
    < HTTP/1.1 301 Moved Permanently
    < Server: Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4
    < Location: http://localhost/mysite
    < Content-Length: 331
    < Content-Type: text/html; charset=iso-8859-1

知道如何解决这个问题吗?

最佳答案

之后

curl -v --noproxy localhost, http://localhost/muestra

curl 响应

About to connect() to localhost port 80 (#0)
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)

所以它清楚地表明它连接到本地主机。

关于bash - Curl:绕过本地主机的代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13559377/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com