Попробуй добавить опцию -v. Я проверил, curl подхватывает переменную, но подключиться не может:
curl -v
https://google.com* Rebuilt URL to:
https://google.com/* Trying
127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (
127.0.0.1) port 1337 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to
google.com:443> CONNECT
google.com:443 HTTP/1.1
> Host:
google.com:443> User-Agent: curl/7.58.0
> Proxy-Connection: Keep-Alive
>
* Proxy CONNECT aborted
* CONNECT phase completed!
* Connection #0 to host localhost left intact
curl: (56) Proxy CONNECT aborted
Дальше лень разбираться )