简体   繁体   中英

Proxy-Authorization: <type> <credentials>?

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 ):

  1. Join username and password with a colon: john:qwerty
  2. Base64-encode the whole string: am9objpxd2VydHk=
  3. Put the encoded string into the 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM