# Redirect\_to("url") with post?

**URL:** <https://www.ruby-forum.com/t/redirect-to-url-with-post/56388>\
**Category:** Rails\
**Created:** [March 30, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/redirect-to-url-with-post/56388 "2006-03-30T19:57:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [March 30, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/redirect-to-url-with-post/56388/1 "2006-03-30T19:57:04Z")

</div>

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](http://whatever.com)”, { ‘postme’ =\> ‘this’ })  
redirect\_to(“[http://whatever.com](http://whatever.com)”, :post =\> { ‘postme’ =\> ‘this’ })  
redirect\_to(“[http://whatever.com](http://whatever.com)”, :options =\> { ‘postme’ =\> ‘this’ })

… and no love.

Thanks!

–  
David H.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [March 30, 2006, 8:15pm UTC](https://www.ruby-forum.com/t/redirect-to-url-with-post/56388/2 "2006-03-30T20:15:30Z")

</div>

redirect\_to(“[http://whatever.com?postme=this](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](http://lists.rubyonrails.org/mailman/listinfo/rails)

Charlie B.  
[http://www.recentrambles.com](http://www.recentrambles.com)

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [October 11, 2006, 12:50am UTC](https://www.ruby-forum.com/t/redirect-to-url-with-post/56388/3 "2006-10-11T00:50:54Z")

</div>

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

> redirect\_to(“[http://whatever.com?postme=this](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!

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [October 11, 2006, 7:42pm UTC](https://www.ruby-forum.com/t/redirect-to-url-with-post/56388/4 "2006-10-11T19:42:49Z")

</div>

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](http://everything.basecamphq.com/archives/000438.php)

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [October 11, 2006, 1:13pm UTC](https://www.ruby-forum.com/t/redirect-to-url-with-post/56388/5 "2006-10-11T13:13:25Z")

</div>

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](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.
