I'm under a proxy, and if I try curl http://localhost/mysite
or curl http://127.0.0.1/mysite
curl try to resolve it with the proxy. So I tried with --noproxy
option, but doesn't work. Is working ok for external servers with the proxy as curl http://mysite.com
.
proxy.domain.xx:1080
without authenticationhttp_proxy=http://proxy.domain.xx:1080
localhost
and *.dev
--noproxy : Comma-separated list of hosts which do not use proxy
$ curl -v http://localhost/mysite
-> Debug:
Response
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
Response
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
Any idea how to fix this?
Curl does not parse NO_PROXY environment variable same as --noproxy flag as expected #2477.
Another way to use proxy with curl is to set the environment variables http_proxy and https_proxy. Note that setting proxy using environment variables works only with MacOS and Linux.
It is recommended that you enclose the proxy server address in double quotes to handle special characters in the URL correctly. Note that the default proxy protocol for Curl is HTTP.
After
curl -v --noproxy localhost, http://localhost/muestra
curl responded with
About to connect() to localhost port 80 (#0) * Trying 127.0.0.1... * Connected to localhost (127.0.0.1) port 80 (#0)
So it clearly stated that it connected to localhost.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With