This article includes a
improve this article by introducing more precise citations. (January 2013))
This article needs additional citations for verification. (January 2013)
Post/Redirect/Get (PRG) is a
When a web form is submitted to a server through an
To avoid this problem, many web developers use the PRG pattern—instead of responding with content, the server responds to a POST request by redirecting the client to another location. The HTTP 1.1 specification introduced the HTTP 303 ("See other") response code to ensure that in this situation, browsers can safely refresh the server response without causing the initial POST request to be resubmitted.
The PRG pattern cannot address every scenario of duplicate form submission. For example, if a web user refreshes before the initial submission completes, possibly because of server lag, a duplicate POST occurs in certain user agents.
User agents (such as browsers) store only the URL of an HTTP request as a bookmark. Because of this, a response based on the body of the HTTP POST request cannot be bookmarked. With the PRG pattern, the URI of the request can safely be bookmarked.
- Chisholm, Wendy; May, Matt (2008). Universal Design for Web Applications. O'Reilly Media, Inc. p. 36.