Google Groups Home
Help | Sign in
Message from discussion redirect_to HTTP POST
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Pat Allan  
View profile
 More options Apr 23, 10:42 pm
From: Pat Allan <p...@freelancing-gods.com>
Date: Thu, 24 Apr 2008 12:42:12 +1000
Local: Wed, Apr 23 2008 10:42 pm
Subject: Re: [rails-oceania] redirect_to HTTP POST
My instinct was that HTTP Redirects have to be GETs... but going by  
the RFC, it seems that's not the case:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3

The statement "The action required MAY be carried out by the user  
agent without interaction with the user if and only if the method used  
in the second request is GET or HEAD." implies that it can be  
something other than GET or HEAD.

As to how to structure a POST Redirect (if it's practically possible  
as opposed to theoretically possible), I've no idea - haven't found  
any clues from my googling.

Sorry I couldn't be more of a help.

--
Pat

On 24/04/2008, at 11:53 AM, taryn wrote:

> Hey all,
> So we're using acts_as_authenticated, and redirecting to the url they
> asked for once they log back into a timed-out account.

> The problem is that redirect_to doesn't seem to preserve the HTTP
> method. This is ok for the faked-up methods eg using "_method=delete"
> But if the URL a person asked for was a POST it fails miserably with a
> routing error (eg:
> no route found to match "/user/42/orders/23/clone" with
> {:method=>:get}

> These sorts of URLs are usually kept inside a button_to.
> if the user, say, has their orders page open for a while, and comes
> back after lunch and clicks "clone me order number 23", and s
> redirected to the login page, when returning it spews as per above
> error message rather than actually redirecting.

> I've been trying to hunt around inside the code to find some way of
> passing in the http method, but have so far come up blank. I've also
> tried passing in the method via the "_method" parameter  - but it
> doesn't work, even for the delete/put buttons (I have a "delete order"
> button, and it redirects to the show page for the order).

> Putting some basic printf debugging into store_location shows that the
> request method has been accurately populated with post/put/delete...
> but I can't find a magic combination to actually pass that into
> redirect_to... becuase it only seems to accept a uri (without request
> headers).

> any ideas?

> Taryn


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google