开发者

why do frameworks use client-side redirects?

开发者 https://www.devze.com 2023-01-16 22:21 出处:网络
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 roun

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 hea开发者_Python百科d, i can only think that it's to rewrite the url in the client browser.. is there anything else i'm missing?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消