Post/Redirect/Get
|
|
This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations. (January 2013) |
|
|
This article needs additional citations for verification. (January 2013) |
Post/Redirect/Get (PRG) is a web development design pattern that prevents some duplicate form submissions, creating a more intuitive interface for user agents (users). PRG implements bookmarks and the refresh button in a predictable way that does not create duplicate form submissions.
Contents |
Bookmarks [edit]
User agents (such as browsers) store only the URI of an HTTP request as a bookmark. Because of this, an HTTP POST request that results in a response based on the body of the HTTP POST request cannot be bookmarked. By using the PRG pattern, the URI of the HTTP GET request can safely be bookmarked by a web user. It is a question of the persistence of the data and the design of the URI whether bookmarking makes sense and is really working at every step of an application.
Proxy servers [edit]
Since redirects are using absolute URIs, one has to take care about proxy servers (HTTP->HTTPS) and reverse proxy servers. If your application is such that a user uses an SSL tunnel to reach your site, this can cause problems also. (You may be able to use the Referer header to discover the domain and port the user is actually entering.)
References [edit]
External links [edit]
- Redirect After Post, Michael Jouravlev, August 2004
- Description of the pattern for J2EE, Michael Jouravlev, August 14, 2003
- GET after POST Adam Vandenberg
- Is the Portlet Programming Model Broken? Subbu Allamaraju
- Doing the PRG in JSF1.2