I'm sending an HTTP request to a server through a proxy with request authentication "Basic". It's a squid proxy. I want to send an HTTP request containing the auth within the headers field. Taking my example:
GET /text.html/ HTTP/1.1
Host: http://Jb.com
Connection: Keep-Alive
Through a proxy say my.proxy.com:8080
but auth is needed say "john:qwerty". How can I put this auth within the request header?
Sending credentials to a server behind a proxy is the same of sending them directly to the server.
Basic authentication is contained into Proxy-Authorization
header, as a base64-encoded colon-separated username and password.
I am assuming that you want to manually craft the authorization value.
Follow these steps (given username john
and password qwerty
):
john:qwerty
am9objpxd2VydHk=
Proxy-Authorization
header. Append this to your HTTP request: Proxy-Authorization: Basic am9objpxd2VydHk=
This should work out of the box with the majority of proxy servers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.