Search code examples
htmlpost-redirect-get

post/redirect/get


In producing a web-based data entry system, is the fact that you are adding an extra server request per page a significant concern when deciding whether or not to use a post/redirect/get design?


Solution

  • The request alone isn't a problem, especially that the alternative gives a pretty bad user experience.

    However, when using a site with load balancing and/or database replication, you need to take care to ensure that the GET after POST will see the data that has been posted.

    When using load balancing and caching, this is sometimes solved with "sticky sessions" that direct the same user to the same machine, so data stored in a write-through cache on that machine will be current.

    When using database replication, GET requests after POST may need to read directly from the "primary" database, instead of a local "secondary" as usual.