How do I make curl ignore the proxy?

Solution 1:

If your curl is at least version 7.19.4, you could just use the --noproxy flag.

curl --noproxy '*' http://www.stackoverflow.com

From the manual.

Solution 2:

I ran into the same problem because I set the http_proxy and https_proxy environment variables. But occasionally, I connect to a different network and need to bypass the proxy temporarily. The easiest way to do this (without changing the environment variables) is:

curl --noproxy '*' stackoverflow.com

From the manual: "The only wildcard is a single * character, which matches all hosts, and effectively disables the proxy."

The * character is quoted so that it is not erroneously expanded by the shell.

Solution 3:

I assume curl is reading the proxy address from the environment variable http_proxy and that the variable should keep its value. Then in a shell like bash, export http_proxy=''; before a command (or in a shell script) would temporarily change its value.

(See curl's manual for all the variables it looks at, under the ENVIRONMENT heading.)

Solution 4:

This works just fine, set the proxy string to ""

curl -x "" http://www.stackoverflow.com