What is HTTP Response Status Code 305 Use Proxy?
HTTP response status code 305 Use Proxy indicates that the requested resource must be accessed through the proxy specified by the server. The client should repeat the request using the proxy provided in the response.
When is HTTP Response Status Code 305 Use Proxy Used?
The 305 status code was intended to instruct clients to use a specific proxy for a particular request. However, it is now deprecated due to security concerns, as it could be used maliciously to redirect users to an untrusted proxy.
Example 1: Using a Specified Proxy
# Client sends a GET request to access a resource. GET /resource HTTP/1.1 Host: www.example.com # Server Response HTTP/1.1 305 Use Proxy Date: Wed, 09 Oct 2024 13:00:00 GMT Server: Apache/2.4.41 (Ubuntu) Location: http://proxy.example.com:8080 # The client is instructed to access the resource through the specified proxy.
Example 2: Redirecting API Requests Through a Proxy
# Client sends a GET request for API data. GET /api/data HTTP/1.1 Host: api.example.com # Server Response HTTP/1.1 305 Use Proxy Date: Wed, 09 Oct 2024 13:02:00 GMT Server: Nginx/1.18.0 Location: http://proxy.api.example.com:8080 # The server requires the client to use the specified proxy for accessing API data.
Summary
The HTTP 305 Use Proxy status code is now rarely used due to security concerns. It indicates that a resource should be accessed through a specified proxy. Modern web applications avoid this status code, and it is generally not supported by browsers.