ggez44
ggez44

Reputation: 903

why do frameworks use client-side redirects?

the frameworks i've used (granted not that many.. pylons,cakephp,rails,etc) all seem to use a client side redirect when going from 1 controller action to another. wouldn't it be better to save a roundtrip and do the redirect server side?

of the top of my head, i can only think that it's to rewrite the url in the client browser.. is there anything else i'm missing?

Upvotes: 2

Views: 116

Answers (2)

Bill Karwin
Bill Karwin

Reputation: 562931

They may want to support cross-host redirects, redirects to SSL, or redirects to other content types (assuming some of the http headers have already been written).

In trying to be as general-purpose and flexible as possible, they fail to optimize for any particular case, even the more common cases. This tendency to be jack-of-all-trades-master-of-none is typical of frameworks.

Upvotes: 1

Jonathan Fingland
Jonathan Fingland

Reputation: 57197

Header redirects after form submission are done to prevent re-POSTing when refreshing the page (or the like)

Upvotes: 3

Related Questions