[Catalyst] Re: internal redirect

A. Pagaltzis pagaltzis at gmx.de
Thu Apr 12 20:44:36 GMT 2007

Hi Adeola,

* Adeola Awoyemi <adeola at digitalcraftsmen.net> [2007-04-11 16:40]:
> In my application I'm generating images on the fly and want to
> redirect to the image if creation succeeds.
> I tried using "$c->response->redirect( $new_filepath )" but
> that  issues a 302 "Temporarily Moved" status. But what I
> actually want is  a way to do the redirect outside of the
> response chain.

how to do this has been answered, but I want to point out that
you may not actually want to do it.

If the request is not for the canonical address of the image,
then you should use an external redirect. Otherwise, the URL that
the browser sees is not that of the image, but that of eg. a form
action address, and people will bookmark (or paste in a forum, or
whatever) the wrong link.

This is particularly important if you are generating an image in
response to a POST request. If you don’t respond with an external
redirect to a POST, then users hitting the Back button might
re-submit the form.

You should use the internal redirect only if the browser is
already sending a request for the canonical address for the
image and it should always use this URL to request the image
you are generating. This might be the case if the image you are
generating is a thumbnail, f.ex.

Aristotle Pagaltzis // <http://plasmasturm.org/>

More information about the Catalyst mailing list