Redirect_to("url") with post?


#1

Is there a Rails-friendly way to redirect_to an url and post some
parameters with that?

I’ve tried:

redirect_to(“http://whatever.com”, { ‘postme’ => ‘this’ })
redirect_to(“http://whatever.com”, :post => { ‘postme’ => ‘this’ })
redirect_to(“http://whatever.com”, :options => { ‘postme’ => ‘this’ })

… and no love.

Thanks!


David H.
removed_email_address@domain.invalid


#2

redirect_to(“http://whatever.com?postme=this”)

On Thu, 2006-03-30 at 11:56 -0600, David H. wrote:

Thanks!


David H.
removed_email_address@domain.invalid


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Charlie B.
http://www.recentrambles.com


#3

Is this the only way to post/pass variables when redirecting a request
to another server?

redirect_to(“http://whatever.com?postme=this”)

I’d like to be able to hide the variables instead of sending them in the
URL. For example, when logged into Basecamp you can view/create
Writeboards without logging into Writeboard even though you are
redirected to a different server/domain. It doesn’t appear to me that
your login or authentication info is being passed from Basecamp to
Writeboard in the URL. Does anyone know how this is done? Thanks!


#4

Thanks Mark. I took another look at how 37signals did the Basecamp to
Writeboard redirection and found out that it is handled by loading up an
intermediate page on the Basecamp server that contains a pre-populated
login form for Writeboard. That page has an onload Javascript function
that then submits the form to Writeboard. Seems to work well except for
those using IE PC with their security settings set to “High” as
described here:

http://everything.basecamphq.com/archives/000438.php


#5

Ben Blakley wrote:

redirected to a different server/domain. It doesn’t appear to me that
your login or authentication info is being passed from Basecamp to
Writeboard in the URL. Does anyone know how this is done? Thanks!

According to http://ppewww.ph.gla.ac.uk/~flavell/www/post-redirect.html
you can control whether a POST redirects as a GET or a POST by changing
the response status code.

But if you don’t need to do stuff in your action prior to redirecting
you can just post directly to the external site from a form on your
page.


We develop, watch us RoR, in numbers too big to ignore.