Forum: Ruby on Rails "You are being redirected" when switching controllers

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
99eaac8c430ee08f8249e8ec2e324c9c?d=identicon&s=25 Iain (Guest)
on 2007-06-18 17:48
Hey folks

I've got a couple of Actions that call methods in different controllers.
So for example I rewrite the URI from

/home

to

/login/login

However, when I do this Firefox displays a "You are being redirected"
message and IE simply dies.

Is there anyway round this or should I just avoid moving controllers
like this.

Cheers
Iain
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2007-06-18 18:41
(Received via mailing list)
I assume this means you're doing something other than the norm:

redirect_to :controller => "login", :action => "login"

or are you talking about

render :action => ...

?

Jason
Cde0427edc3138a49ec9f07a07b7079f?d=identicon&s=25 Niels Meersschaert (Guest)
on 2007-06-18 23:50
(Received via mailing list)
How are you doing the rewrite?  I do this same practice all the
time.  It's pretty simple.  In the action for home you check if they
need to login if they do, then use this snippet:
redirect_to :controller => "login", :action => "login"

This causes a 302 status code with the correct target url.

Niels
99eaac8c430ee08f8249e8ec2e324c9c?d=identicon&s=25 Iain (Guest)
on 2007-06-19 11:06
Hi folks.

Thanks for the replies.  To explain the full problem.  I run my site on
a shared host, I know it's not ideal, but it is cheap.  To achieve this
I have to run Mongrel using a different port from 80 as my hosting
company has Apache running on port 80.  So the URI looks like this:

www.mysite.com:3500/home

I've set up a redirect in the .htaccess file so if a user types in
www.mysite.com they are forwarded to www.mysite.com:3500/home

And from what you are saying I'm wondering if the redirect is part of
the problem as I've set it up as a Permanent 302 redirect.

The problem comes when the user clicks the login button on the home
page, the login form code is as follows.

<% form_tag :controller => 'login', :action => 'login' do %>

The browser then writes the URI as www.mysite.com:3500/login/login and
that's when I get the redirect error.

Annoyingly this doesn't happen when I'm working from localhost

Any ideas greatfully received :-)
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2007-06-19 14:42
(Received via mailing list)
I'd say do one of two things:

Get rid of the .htaccess redirect. You're bypassing, and thus confusing,
Rails.

Move the Rails site to have it's root at www.mysite.com:3500/home. This
seems like it would fit your situation better.

Jason
9d4960f8319664f0f7896230eebace73?d=identicon&s=25 DamnBigMan@gmail.com (Guest)
on 2007-07-28 00:18
(Received via mailing list)
I'm having the same problem all of a sudden.

I'm using the following form:

    redirect_to :action => "list"

Whenever it hits code like this I get a you are being re-directed
page, which doesn't actually re-direct either.
022ef7af8f7aff95046e751643104e3f?d=identicon&s=25 Nominerdene Purevjav (nmnrdn)
on 2010-06-15 07:57
I solved this problem by downgrading my rails version to 2.3.5.

To downgrade run command gem install -v=2.3.5 rails

I Hope soon it will be fixed in 2.3.8 version.

Iain wrote:
> Hey folks
>
> I've got a couple of Actions that call methods in different controllers.
> So for example I rewrite the URI from
>
> /home
>
> to
>
> /login/login
>
> However, when I do this Firefox displays a "You are being redirected"
> message and IE simply dies.
>
> Is there anyway round this or should I just avoid moving controllers
> like this.
>
> Cheers
> Iain
3ca4ad042effe02400fde5524f25edc1?d=identicon&s=25 Iwan B. (1w4n)
on 2010-06-15 14:40
Nominerdene Purevjav wrote:
> I solved this problem by downgrading my rails version to 2.3.5.
>
> To downgrade run command gem install -v=2.3.5 rails
>
> I Hope soon it will be fixed in 2.3.8 version.
>
> Iain wrote:
>> Hey folks
>>
>> I've got a couple of Actions that call methods in different controllers.
>> So for example I rewrite the URI from
>>


Same problem (but with v. 2.3.8) and same solution (downgrade to 2.3.5).

(With glesys.se VPS, Ubuntu 8.04, monit+mongrel)

Thanks a lot!

Iwan
974b0625894a3b9fcd3e300ddb3f41bf?d=identicon&s=25 Lenart Rudel (lenart)
on 2010-08-22 23:21
Iwan Buetti wrote:
> Same problem (but with v. 2.3.8) and same solution (downgrade to 2.3.5).
>
> (With glesys.se VPS, Ubuntu 8.04, monit+mongrel)
>
> Thanks a lot!
>
> Iwan

Got same problem on Rails 2.3.8, running FreeBSD 7.0, Mongrel 1.1.5
(using clusters). Downgrading to Rails 2.3.5 solved this problem. I
believe it's a combination with mongrel since the same code works
flawlessly on passenger.

I also got errors (ActionController::InvalidAuthenticityToken). I tried
clearing cache, restarting server, ... but nothing seemed to work.
Downgrading to 2.3.5 solved this issue as well.

Lenart
This topic is locked and can not be replied to.