When specifying a username and password in the URL of a curl request. Curl automatically creates an Authorization header. e.g.

curl -vk -L http://user:password@firstdomain.com


Authorization: Basic dXNlcjpwYXNzd29yZA==

To the request.

This Authorization header is not generated when the webserver returns a redirect header that contains a username and password in the url. e.g. The response Location header is set to:

Location: http://user:password@seconddomain.com

A second GET request is sent to seconddomain.com but no Authorization header is present. How can I get curl to generate the Authorization header for a redirect that contains its own username and password combination?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.