Subscribe to PHP Freaks RSS

303 See Other

syndicated from planet-php.net on October 2, 2018

303 See Other can be used to tell a client that the result of the operation can be found on another location.



For example, if a client did a POST request, a server might immediately respond to that POST request with a response body, for example to inform the client or user that the operation was successful.



It’s sometimes better to not do that, and immediately redirect the user to a new page instead. One reason is that in browsers, it messes with the “back” button and will ask the user to submit the a form again. When redirecting immediately, browsers don’t do this and this is extremely common practice.



So 303 means that the server is not immediately returning a result, but it instructs the client to go look somewhere else to get the result. The client must use a GET request for this.



Most webservices and server frameworks incorrectly use the 302 Found status-code for this instead.



Example



HTTP/1.1 303 See Other
Server: Curveball/0.4.0
Location: /confirmation


References