HTTP status code 300 indicates that the server has multiple possible responses for the client’s request. When the server cannot determine the most appropriate response, it returns this status code and provides a list of resources for the client to choose from.
Common Scenarios
-
Redirection: When there are multiple available responses for the requested resource, the server can return a 300 status code and provide a list of resources in the response body for the client to choose from.
-
Transparent Proxy: When a client requests a resource and the server acts as a transparent proxy, it may receive multiple responses, prompting the proxy server to return a 300 status code and inform the client of the multiple choices.
-
Content Negotiation: During content negotiation, if the server has multiple versions of a resource available, it may return a 300 status code, allowing the client to decide which version to use.
Response Format
A 300 response typically includes a Content-Type
header with the value text/html
. The response body is usually an HTML page listing the available resources and their URLs, allowing the client (such as a browser) to display this page for the user to make a selection.
Example Response
HTTP/1.1 300 Multiple Choices Content-Type: text/html
<a href="/resource1">Resource 1</a>
<a href="/resource2">Resource 2</a>
<a href="/resource3">Resource 3</a>
In this example, the status code 300 indicates that the server has provided three resources for the client to choose from. The client can select one resource to access based on user input or other logic.
Note: The 300 status code is no longer widely used and has been largely replaced by more specific status codes (like 301 for Permanent Redirect and 302 for Temporary Redirect). Modern web browsers and clients typically do not encounter the 300 status code, as they usually automatically select the most appropriate response.