• November 12, 2024

Http 1_1 407 Proxy Authentication Required Curl

curl through authenticated proxy and authenticated http resource

curl through authenticated proxy and authenticated http resource

I want to do a post (twitter in this case) with a oneliner.
If I don’t have proxy
curl -u user:pass -d status=”message”
works perfectly.
But when I am behind a authenticated proxy it doesn’t.
I had tryied:
curl -X proxy:port -U proxyUser:proxyPass -u user:pass -d status=”message”
That it jump me with an
proxy do not support basic auth
So do you know what I am doing wrong?
thanks in advance.
asked Nov 6 ’10 at 0:08
Cababunga’s answer is correct, but they’re missing another option: –proxy-ntlm. Some proxies won’t authorize correctly with –proxy-anyauth, so ideally you’ll want to specify the authentication method that your proxy uses. If you run curl -v -U user:pass -x proxy:port –url, you should get something along the lines of the following:
About to connect() to proxy [your proxy] port [your port] (#0)
Trying [IP]…
connected
Connected to [your proxy] ([IP]) port [your port] (#0)
Establish HTTP proxy tunnel to Proxy auth using Basic with user ‘[user]’
CONNECT HTTP/1. 1
Host: Proxy-Authorization: Basic [gibberish]
User-Agent: curl/[ver] ([OS]) libcurl/[ver] OpenSSL/[ver] zlib/[ver]
Proxy-Connection: Keep-Alive
HTTP/1. 1 407 Proxy Authentication Required
Proxy-Authenticate: NEGOTIATE
Proxy-Authenticate: NTLM
Add a flag for whatever you see in the Proxy-Authenticate parameter and you should be good to go. In this example, you would add the –proxy-ntlm flag.
spottedmahn12. 1k8 gold badges82 silver badges146 bronze badges
answered Feb 28 ’13 at 17:15
MicahMicah1811 silver badge3 bronze badges
You may be able to put the username/password in the URL for the authenticated resource to avoid having extra command line complications.
also, the –proxy shortcut is a lowercase x, as cababunga pointed out.
curl -x proxyaddr:port -U proxyUser:proxyPass -u user:pass -d status=”message”
answered Nov 6 ’10 at 11:32
tweak2tweak26035 silver badges15 bronze badges
Try to add –proxy-digest or –proxy-anyauth.
And I think to connect to proxy you should use lower case -x (not -X).
answered Nov 6 ’10 at 0:33
cababungacababunga3, 00313 silver badges23 bronze badges
You may want to try using SOCKS v5 instead of v4:
$ curl –proxy socks5proxyUser:proxyPass@proxy:port…
answered Mar 28 ’17 at 15:01
WernightWernight32. 9k23 gold badges111 silver badges131 bronze badges
I managed to perform this with the help of the Micah’s answer here:
this is the command I got at the end to access a BitBucket repo:
curl -u userBitbucket:PwdBitBucket -U userProxy:pwdProxy -x address_proxy:port:proxy –proxy-ntlm host:port/projects/project/repos/repo/browse/file
answered Dec 15 ’16 at 10:13
Ualter Jr. 2, 0881 gold badge22 silver badges24 bronze badges
Not the answer you’re looking for? Browse other questions tagged rest curl or ask your own question.
curl doesn't pass username:password to proxy · Issue #2575

curl doesn’t pass username:password to proxy · Issue #2575

New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
bagder
changed the title
curl doesn’t bybass username:password to proxy
curl doesn’t pass username:password to proxyMay 16, 2018
lock
bot
locked as resolved and limited conversation to collaborators
Aug 15, 2018
Using cURL with a Proxy Server - Stefan Bruhns

Using cURL with a Proxy Server – Stefan Bruhns

If you are located inside a network that uses a proxy and authentication for making HTTP requests
to external servers, you need to pass proxy parameters and authentication credentials when using
cURL with a proxy server. I used cURL on macOS Sierra for the examples here. An alternative to using
cURL’s proxy options is to use environment variables. You can read about that approach using the
link below.
In the following examples, I am using the parameters shown in table 1. The Yahoo Finance API
URL returns stock data in JSON format.
Active Directory Domain
ABC
URL
Table 1: Values used in this post’s examples
Example 1: HTTP GET Request via Proxy without Authentication
The simplest command, using cURl’s -x option to specify a proxy server that does not require authentication is:
curl -x
If the proxy server uses a port other than the standard HTTP port, you must append it to the hostname with a colon:
Example 2: HTTP GET Request via Proxy with Authentication
If the proxy requires authentication with a username and password,
use the -U option and separate the values with a colon.
Note that special characters such as the @ character need to be
escaped with a backslash character.
curl -U dave:P@ssW0rd -x
The backslash character needs to be escaped as well. So, for passing a network domain name in the
-U option, use \.
curl -U ABC\dave:P@ssW0rd -x
Additional special characters that need to be escaped with a backslash are listed in the following table.!
Exclamation Mark
`
Grave Accent
{
Left Brace
[
Left Bracket
(
Left Parenthesis
#
Number Sign?
Question Mark

Quotation Mark}
Right Brace]
Right Bracket)
Right Parenthesis;
Semicolon
< Less-Than Sign >
Greater-than Sign
$
Dollar Sign
|
Vertical Bar
Example 3: Setting Proxy Authentication Scheme
In the previous example, the Basic authentication scheme was used by default. If your proxy requires
NTLM authentication, it can be specified using the –proxy-ntlm option.
You can also use the –proxy-anyauth to let cURL determine the proxy
authentication scheme by evaluating the 407 response of the proxy.
curl -U ABC\dave:P@ssW0rd -x –proxy-ntlm
Debugging cURL HTTP Requests with Verbose Option
Use the -v option so that cURL prints out verbose information while running.
This can be used for evaluating the HTTP request and response exchanges between cURL and the proxy.
bash-3. 2$ curl -U dave:P@ssW0rd -v -x * Trying 10. 89. 4. 75…
* TCP_NODELAY set
* Connected to (10. 75) port 8080 (#0)
* Establish HTTP proxy tunnel to
* Proxy auth using Basic with user ‘dave’
> CONNECT HTTP/1. 1
> Host:
> Proxy-Authorization: Basic QURTXHNicnVobnM6V2ludGVyQDIwMTk=
> User-Agent: curl/7. 54. 0
> Proxy-Connection: Keep-Alive
< HTTP/1. 0 200 Connection established * Proxy replied OK to CONNECT request * TLS 1. 2 connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 * Server certificate: * * Server certificate: DigiCert SHA2 High Assurance Server CA * Server certificate: DigiCert High Assurance EV Root CA > GET /v8/finance/chart/AAPL HTTP/1. 1
> Accept: */*
< HTTP/1. 1 200 OK < X-Yahoo-Request-Id: a4cu6apedh7m3 < Cache-Control: max-age=10, stale-while-revalidate=15 < Content-Type: application/json;charset=utf-8 < Vary: Origin < Date: Sun, 12 May 2019 22:31:31 GMT < Age: 0 < Server: ATS < X-Frame-Options: SAMEORIGIN < Referrer-Policy: no-referrer-when-downgrade < Strict-Transport-Security: max-age=15552000 < Transfer-Encoding: chunked < Connection: keep-alive < Expect-CT: max-age=31536000, report-uri=" < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < Public-Key-Pins-Report-Only: max-age=2592000; pin-sha256="2fRAUXyxl4A1/XHrKNBmc8bTkzA7y4FB/GLJuNAzCqY="; pin-sha256="I/Lt/z7ekCWanjD0Cvj5EqXls2lOaThEA0H2Bg4BT/o="; pin-sha256="Wd8xe/qfTwq3ylFNd3IpaqLHZbh2ZNCLluVzmeNkcpw="; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="i7WTqTvh0OioIruIfFR4kMPnBqrS2rdiVPl/s2uC/CY="; pin-sha256="r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E="; pin-sha256="uUwZgwDOxcBXrQcntwu+kYFpkiVkOaezL0WYEZ3anJc="; pin-sha256="dolnbtzEBnELx/9lOEQ22e6OZO/QNb6VSSX2XHA3E7A="; includeSubdomains; report-uri=" <{ "chart": "result": "meta": "currency":"USD", "symbol":"AAPL", "exchangeName":"NMS", "instrumentType":"EQUITY", "firstTradeDate":345459600, "gmtoffset":-14400.... For more information on using cURL with a proxy server, refer to the cURL documentation at cURL supports many protocols. To see how cURL can be used to transfer data via FTP, follow the link:

Frequently Asked Questions about http 1_1 407 proxy authentication required curl

How do I fix 407 proxy authentication required?

In order to resolve the issue we can recommend the following options: 1. Configure the internet connection to not use the Proxy server. In the Internet Explorer, open the Internet Options dialog box, click Connections, click LAN Settings, and disable “Use a Proxy Server…”.

Why do I need 407 proxy authentication?

The HTTP 407 Proxy Authentication Required client error status response code indicates that the request has not been applied because it lacks valid authentication credentials for a proxy server that is between the browser and the server that can access the requested resource.Jul 8, 2021

How do I check my proxy authentication?

Go to Settings > General > Database Download. Verify that Use proxy server or firewall is selected, and that the correct server and port are listed. Make sure that the Authentication settings are correct. Verify the user name and password, checking spelling and capitalization.

Leave a Reply

Your email address will not be published. Required fields are marked *