300 Multiple Choices
The HTTP300 Multiple Choicesredirection response status code indicates that the request has more than one possible response.The user-agent or the user should choose one of them.
Note:Inagent-driven content negotiation, a client and server collaboratively decide the best variant of a given resource when the server has multiple variants.Most clients lack a method for automatically choosing from responses, and the additional round-trips slow down client-server interaction.Server-driven content negotiation is far more common, where a server chooses the most appropriate resource for the client based on the request headers (Accept-Language,Accept, etc.).
The server should include content in the response that contains a list of resource metadata and URIs from which the user or user agent can choose.The format of the content is implementation-specific, but should be easily parsed by the user agent (such as HTML or JSON).
If the server has a preferred choice that the client should request, it can include it in aLocation header.
In this article
Status
300 Multiple ChoicesExamples
>300 response with list of resources
The following example demonstrates a Transparent Content Negotiation request-response exchange.An Apache server offers multiple variants of a resource defined in atype map;index.html.en for a resource in English, andindex.html.fr for a French version:
URI: index.html.enContent-Language: enURI: index.html.frContent-Language: frANegotiate: trans request header indicates that the client wants to use TCN to choose a resource.Poor browser support for this mechanism means a user agent such as curl must be used instead:
curl -v -H "Negotiate: trans" http://localhost/indexThis produces the following request:
GET /index HTTP/1.1Host: localhostUser-Agent: curl/8.7.1Accept: */*Negotiate: transWe receive a300 response with details of different representations of the requested resource:
HTTP/1.1 300 Multiple ChoicesDate: Fri, 30 Aug 2024 09:21:48 GMTServer: Apache/2.4.59 (Unix)Alternates: {"index.html.en" 1 {type text/html} {language en} {length 48}}, {"index.html.fr" 1 {type text/html} {language fr} {length 45}}Vary: negotiate,accept-languageTCN: listContent-Length: 419Content-Type: text/html; charset=iso-8859-1<html><head><title>300 Multiple Choices</title></head><body><h1>Multiple Choices</h1>Available variants:<ul><li><a href="index.html.en">index.html.en</a> , type text/html, language en</li><li><a href="index.html.fr">index.html.fr</a> , type text/html, language fr</li></ul></body></html>Specifications
| Specification |
|---|
| HTTP Semantics> # status.300> |