# Rails is redirecting multiple times?

**URL:** <https://www.ruby-forum.com/t/rails-is-redirecting-multiple-times/123603>\
**Category:** Rails\
**Created:** [December 19, 2007, 2:26am UTC](https://www.ruby-forum.com/t/rails-is-redirecting-multiple-times/123603 "2007-12-19T02:26:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nhorton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/53a042/32.png) [@nhorton](https://www.ruby-forum.com/u/nhorton)\
**Post date:** [December 19, 2007, 2:26am UTC](https://www.ruby-forum.com/t/rails-is-redirecting-multiple-times/123603/1 "2007-12-19T02:26:12Z")

</div>

I am getting some very strange behavior where Rails seems to be  
sending multiple redirects to the client from one action. The code  
does not suggest this could happen, but I am seeing the following log  
entries:

Processing FacebookAppsController#post\_add (for 99.230.141.157 at  
2007-12-18 14:15:42) [GET]  
Session ID: 382613da73aee01e1bec169f9df9c8f2  
Parameters: {“api\_key”=\>“921198edc5e865404c05da8a71f300c2”,  
“installed”=\>“1”, “action”=\>“post\_add”,  
“auth\_token”=\>“54b130636eb352a4d53014d645cad9e5”,  
“controller”=\>“facebook\_apps”}  
Redirected to

> **[Log into Facebook](https://apps.facebook.com/aga_khan/facebook_apps/install?cookie_token=1c84cdf8-dec6-4f28-b6f5-4979b354ffe1&)**
>
> Log into Facebook to start sharing and connecting with your friends, family, and people you know.

Completed in 0.09034 (11 reqs/sec) | DB: 0.05949 (65%) | 302 Found  
[[http://production.rapouts.com/facebook\_apps/post\_add](http://production.rapouts.com/facebook_apps/post_add)?  
api\_key=921198edc5e865404c05da8a71f300c2&auth\_token=54b130636eb352a4d53014d645cad9e5&installed=1]  
Cookie set: viewer\_token=6fafdc44-0b5b-472a-b04c-12ff8bc0956d; path=/;  
expires=Sat, 16 Feb 2008 22:15:42 GMT  
Redirected to  
[Log into Facebook](http://apps.facebook.com/aga_khan/facebook_apps/install?cookie_token=6fafdc44-0b5b-472a-b04c-12ff8bc0956d&app=5&referrer=42712&action=pre_add&api_key=921198edc5e865404c05da8a71f300c2&referral_token=839976c8-27dd-4be1-b68e-5791c42af7dd&campaign=61&controller=facebook_apps&has_seen_video=true&ref_tag=campaigns/player/next_button&source=invite)  
\<[Log into Facebook](http://apps.facebook.com/aga_khan/facebook_apps/install)?  
cookie\_token=6fafdc44-0b5b-472a-  
b04c-12ff8bc0956d&app=5&referrer=42712&action=pre\_add&api\_key=921198edc5e865404c05da8a71f300c2&referral\_token=839976c8-27dd-4be1-  
b68e-5791c42af7dd&campaign=61&controll\>  
Completed in 0.07579 (13 reqs/sec) | DB: 0.07197 (94%) | 302 Found  
[[http://production.rapouts.com/facebook\_apps/post\_add](http://production.rapouts.com/facebook_apps/post_add)?  
api\_key=921198edc5e865404c05da8a71f300c2&auth\_token=54b130636eb352a4d53014d645cad9e5&installed=1]

Note that there are two redirects in there. I am seeing this happen  
repeatedly in my logs, so I don’t think this was just two mongrels  
having log messages overlap as sometimes happens.

Does anyone have any ideas on this?

---

<div class="post-metadata">

**Author:** ![nhorton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/53a042/32.png) [@nhorton](https://www.ruby-forum.com/u/nhorton)\
**Post date:** [December 19, 2007, 2:30am UTC](https://www.ruby-forum.com/t/rails-is-redirecting-multiple-times/123603/2 "2007-12-19T02:30:53Z")

</div>

_I don’t see two redirects. I see this as the first request:_

Processing FacebookAppsController#post\_add (for 99.230.141.157 at  
2007-12-18 14:15:42) [GET]  
Session ID: 382613da73aee01e1bec169f9df9c8f2  
Parameters: {“api\_key”=\>“921198edc5e865404c05da8a71f300c2”,  
“installed”=\>“1”, “action”=\>“post\_add”,  
“auth\_token”=\>“54b130636eb352a4d53014d645cad9e5”,  
“controller”=\>“facebook\_apps”}  
Redirected to

> **[Log into Facebook](https://apps.facebook.com/aga_khan/facebook_apps/install?cookie_token=1c84cdf8-dec6-4f28-b6f5-4979b354ffe1&)**
>
> Log into Facebook to start sharing and connecting with your friends, family, and people you know.

Completed in 0.09034 (11 reqs/sec) | DB: 0.05949 (65%) | 302 Found  
\*  
And then this as another:

\*[[http://production.rapouts.com/facebook\_apps/post\_add](http://production.rapouts.com/facebook_apps/post_add)?  
api\_key=921198edc5e865404c05da8a71f300c2&auth\_token=54b130636eb352a4d53014d645cad9e5&installed=1  
]  
Cookie set: viewer\_token=6fafdc44-0b5b-472a-b04c-12ff8bc0956d; path=/;  
expires=Sat, 16 Feb 2008 22:15:42 GMT  
Redirected to  
[Log into Facebook](http://apps.facebook.com/aga_khan/facebook_apps/install?cookie_token=6fafdc44-0b5b-472a-b04c-12ff8bc0956d&app=5&referrer=42712&action=pre_add&api_key=921198edc5e865404c05da8a71f300c2&referral_token=839976c8-27dd-4be1-b68e-5791c42af7dd&campaign=61&controller=facebook_apps&has_seen_video=true&ref_tag=campaigns/player/next_button&source=invite)  
\<[Log into Facebook](http://apps.facebook.com/aga_khan/facebook_apps/install)?  
cookie\_token=6fafdc44-0b5b-472a-  
b04c-12ff8bc0956d&app=5&referrer=42712&action=pre\_add&api\_key=921198edc5e865404c05da8a71f300c2&referral\_token=839976c8-27dd-4be1-  
b68e-5791c42af7dd&campaign=61&controll\>  
Completed in 0.07579 (13 reqs/sec) | DB: 0.07197 (94%) | 302 Found

Your application isn’t erroring, is it? You shouldn’t have to worry  
about  
anything if it isn’t.

On Dec 19, 2007 11:55 AM, NHorton [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> “installed”=\>“1”, “action”=\>“post\_add”,  
> expires=Sat, 16 Feb 2008 22:15:42 GMT
> 
> api\_key=921198edc5e865404c05da8a71f300c2&auth\_token=54b130636eb352a4d53014d645cad9e5&installed=1  
> ]
> 
> Note that there are two redirects in there. I am seeing this happen  
> repeatedly in my logs, so I don’t think this was just two mongrels  
> having log messages overlap as sometimes happens.
> 
> Does anyone have any ideas on this?
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!
