0

I have configuration the proxy in macOS 13.2.1 terminal(using iterm right now) like this:

➜  retire git:(master) env|grep 'proxy'
all_proxy=socks5://127.0.0.1:7890

then using curl to access google:

➜  retire git:(master) curl -L -v google.com
* Uses proxy env variable all_proxy == 'socks5://127.0.0.1:7890'
*   Trying 127.0.0.1:7890...
* SOCKS5 connect to IPv4 142.251.42.238:80 (locally resolved)
* SOCKS5 request granted.
* Connected to (nil) (127.0.0.1) port 7890 (#0)
> GET / HTTP/1.1
> Host: google.com
> User-Agent: curl/7.86.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Location: http://www.google.com/
< Content-Type: text/html; charset=UTF-8
< Date: Wed, 15 Mar 2023 23:22:56 GMT
< Expires: Fri, 14 Apr 2023 23:22:56 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 219
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
<
* Ignoring the response-body
* Connection #0 to host (nil) left intact
* Issue another request to this URL: 'http://www.google.com/'
* Uses proxy env variable all_proxy == 'socks5://127.0.0.1:7890'
* Hostname 127.0.0.1 was found in DNS cache
*   Trying 127.0.0.1:7890...
* SOCKS5 connect to IPv4 159.138.20.20:80 (locally resolved)
* SOCKS5 request granted.
* Connected to (nil) (127.0.0.1) port 7890 (#1)
> GET / HTTP/1.1
> Host: www.google.com
> User-Agent: curl/7.86.0
> Accept: */*
>
^C

it could not fetch the google html code. I also have tried to configure the proxy with my wifi like this:

enter image description here

still could not work. is it possible to using proxy in terminal? this configuration in google chrome works fine. the wifi proxy was enabled:

➜  retire git:(master) networksetup -getwebproxy Wi-Fi

Enabled: Yes
Server: 127.0.0.1
Port: 7890
Authenticated Proxy Enabled: 0
1
  • It looks like curl is using the proxy correctly, maybe something wrong with the proxy itself? Also, try with "www.google.com" (i.e. including the "www", so it doesn't have to redirect from plain "google.com"). Mar 16 at 2:00

0

You must log in to answer this question.

Browse other questions tagged .