0

I know it is pretty straightforward to use/export http_proxy and https_proxy in any Linux variant but, when it becomes tricky if we want to use with authentication like below,

I have test this it is works fine with curl directly without http_proxy or https_proxy on,

unset http_proxy; curl -x http://proxy-abc-xyz.com:8080 --proxy-user [email protected] -L http://www.yahoo.com

Above command asks for the password :

I enter it on the screen, the page loads up, which is completely fine.

My Password is something like this :

A@CDe2022@@@

But when I try with simple export command, I couldn't able to make it work,

export http_proxy="http://[email protected]:A@CDe2022@@@@proxy-abc-xyz.com:8080"
export https_proxy="http://[email protected]:A@CDe2022@@@@proxy-abc-xyz.com:8080"

Three @@@'s are in password the next one is for the domain.

But the above is not working somehow.

When I try with curl -v https://www.google.com the command just stalls there no output at all, it tries to connect but it is not able to get through.

Could someone help with this?

Thank you!

5
  • Does this answer your question? special characters in http_proxy environment variable Jun 17, 2022 at 16:11
  • @NikitaKipriyanov thanks for the update, it does makes sense but, even after using the encoding it doesn't work for me. But the same proxy works this way, curl -x http://proxy-abc-xyz.com:8080 --proxy-user [email protected]:<password> -L http://www.yahoo.com I get the below output using curl when I export the proxy with http_proxy, https_proxy, HTTP_PROXY, HTTPS_PROXY, NO_PROXY, and no_proxy. curl -v www.google.com * About to connect() to proxy abc-xyz.com port 0 (#0) * Trying <ip-address>... It stalls here. Tried both ways like encoding the URL & password way
    – Vijay
    Jun 18, 2022 at 15:48
  • You hand't encoded the symbol '@', did you? So it thought the the host name to connect to is after the first '@', that is, in the username — abc-xyz.com, and then the port is after ':' is not integer and it was understood as "0". Encoded [email protected] will look like iam%40abc-xyz.com, A@CDe2022@@@ is encoded as A%40CDe2022%40%40%40, and the whole thing needs to look like http://iam%40abc-xyz.com:A%40CDe2022%40%40%[email protected]:8080. Notice there is only a single '@' character here, and it is after the password. There is no '@' in username or in password - it is urlencoded. Jun 18, 2022 at 18:05
  • Thanks for your inputs again! encoding worked but it is able to recognise the password but I have got the below thingy in CURL, which doesn't mean the authentication is successful. * Proxy auth using Basic with user '[email protected]:A@CDe2022@@@' > CONNECT www.google.com:443 HTTP/1.1 > Host: www.google.com:443 > Proxy-Authorization: Basic cmFtY > User-Agent: curl/7.29.0 > Proxy-Connection: Keep-Alive > < HTTP/1.1 407 Proxy **Authentication Required** < Proxy-Authenticate: NEGOTIATE < Proxy-Authenticate: NTLM < Proxy-Authenticate: BASIC realm="ntlm"
    – Vijay
    Jun 19, 2022 at 14:43
  • I have managed to make it work with cntlm in Linux however, I having SSL Verify Failed issue with that.
    – Vijay
    Jun 19, 2022 at 14:44

1 Answer 1

1

Try this:

export http_proxy="http://userName:[email protected]:8080" export https_proxy="http://userName:[email protected]:8080"

CAVEAT: Some app need to have the http_proxy`s variable in capital. So I suggess you use both set. Lower case ans capital case.

export http_proxy and https_proxy as well as HTTP_PROXY and HTTPS_PROXY

Also, this is verrry usefull..

NO_PROXY= and also.
no_proxy=

2
  • Thanks for the update, it does makes sense but, even after using the encoding it doesn't work for me. But the same proxy works this way, curl -x http://proxy-abc-xyz.com:8080 --proxy-user [email protected]:<password> -L http://www.yahoo.com I get the below output using curl when I export the proxy with http_proxy, https_proxy, HTTP_PROXY, HTTPS_PROXY, NO_PROXY, and no_proxy. curl -v www.google.com * About to connect() to proxy abc-xyz.com port 0 (#0) * Trying <ip-address>... It stalls here. Tried both ways like encoding the URL & password way
    – Vijay
    Jun 18, 2022 at 15:49
  • May be like this: http_proxy="http://'domain\user':'password':proxyUrl.com:8080"
    – yield
    Jun 20, 2022 at 15:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .