HTTP 303 'see other' response om beter om te gaan met POST requests

Monday 03 January 2005, 23:52:00 | web dev

HTTP status code 303 ("See Other") zou wel eens interessant kunnen zijn om veel problemen mbt POST requests op te lossen, zoals double-posts door pagina refresh etc. Wat doet 303? Bijna hetzelfde als 302 (redirect): "The client should present a GET request to the new URL specified in the Location: header. No user confirmation is required." De courante browsers snappen een 303 response wel. Alleen stokoude zoals Netscape 4 gaan er niet goed mee om.

Meer info: Redirect in response to POST en 303-see other.

uit de HTTP 1.1 spec:

"10.3.4 303 See Other"

The response to the request can be found under a different URI and should be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource. The 303 response must not be cached, but the response to the second redirected) request might be cacheable.

The different URI should be given by the Location field in the response. Unless the request method was HEAD, the entity of the response should contain a short hypertext note with a hyperlink to the new URI(s).

Note: Many pre-HTTP/1.1 user agents do not understand the 303 status. When interoperability with such clients is a concern, the 302 status code may be used instead, since most user agents react to a 302 response as described here for 303.