HTTP Headers
Proxy Authorization
The HTTP Proxy-Authorization
request header carries the credentials needed for a client to authenticate with a proxy server. Typically, this header is sent after the proxy responds with a 407 Proxy Authentication Required
status, which includes the Proxy-Authenticate
header to specify the authentication method. This helps ensure that only authorized clients can access resources through the proxy.
Syntax
Proxy-Authorization: <auth-scheme> <credentials>
Directives
<auth-scheme>
A case-insensitive token indicating the Authentication scheme used.
Some common types includeBasic
,Digest
,Negotiate
, andAWS4-HMAC-SHA256
.
The Internet Assigned Numbers Authority (IANA) maintains a list of authentication schemes, but other schemes may be offered by various host services.<credentials>
Credentials used for the authentication scheme.
Typically, you should consult relevant specifications to determine the proper format.
Example
Examples
Basic authentication involves sending credentials in the format <username>:<password>
, such as aladdin:opensesame
. This string is then encoded using Base64, resulting in a string like YWxhZGRpbjpvcGVuc2VzYW1l
.
To include this in an HTTP request, you add a header like this:
Proxy-Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l
Using HTTPS is strongly recommended when employing authentication methods, especially for Basic authentication, to ensure the credentials are encrypted during transmission.
Bearer authentication (auth token)
This method involves sending a token instead of username and password. The token is included in the HTTP header like this:
Proxy-Authorization: Bearer kNTktNTA1My00YzLT1234
How to Modify Header using Requestly
- Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
- Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
- Add a new header modification:
- Under “Action”, select “Add” or “Override”.
- In the “Header Name” field, enter Proxy-Authorization.
- In the “Header Value” field, enter the desired authorization token (e.g., Basic YWxhZGRpbjpvcGVuc2VzYW1l).
- Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-proxy-server.com/*).
- Save the rule.
Once set up, Requestly will inject the specified Proxy-Authorization header into all matching requests, allowing you to easily test proxy authentication scenarios or override headers without changing system-wide proxy settings.
You might need to modify the Proxy-Authorization header to test how your application interacts with authenticated proxies or when you want to simulate different proxy credentials without actually switching proxies. This helps in debugging and ensuring proper access control.
Table of Contents
- No headings found.