Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
redirect_to failing at Dreamhost
15 Posts
redirect_to failing at Dreamhost


I've developed a simple Rails blog application that I'm hosting with Dreamhost. I have a login page which allows the blog administrator, i.e. me, to login and create new blog posts, etc. At the moment I'm having a problem with the login page which has a form asking for username and password and a submit button.

I think that the problem I am getting is centred around a 'redirect_to' call. Basically, when my application acknowledges a successful login a 'redirect_to' command should redirect the browser to the main blog admin. page. Most of the time this doesn't happen and instead I am seeing a dialogue box in Firefox stating, "You have chosen to open blog which is a: BIN file". "blog" is the name of the admin. page I'm trying to access.

I've tried accessing the site using MS Explorer which gives a dialogue box which mentions an application/octet-stream.

Does anyone have any ideas? I'm am guessing that there is a problem with my configuration and that the redirect that is sent to the browser is not a valid HTTP response for some reason. This is the first site I've actually had hosted so I'm very new to this. One thing to say is that the site works ok on my local PC.



Sounds more like a server misconfiguration, especially if it doesn't happen in your dev env. Unless you're setting the content type, or using something unusual like send_file (but both of those should have shown up in your dev env).

Let's start with you using "pastie.org":http://pastie.org/ to paste the controllers with both actions in them. Post every method and filter that's used for both handling the login, and rendering the blog admin page.

Also, is it possible for you to setup two pages that do the same thing but are non-admin pages, so we can actually have a look in your production environment? This will assist in seeing whether it's a server misconfiguration.

Agree with "it sounds like a server misconfiguration".

Try to append response.headers['Content-Type'] = 'text/html' as before_filter in your controller.

Thanks guys. I'll make those controllers available in a little while.

Ok here goes. This is the first time I've used pastie, so I apologise if it doesn't workout first time around.

I hope I've given you enough code to go on. If you need more please let me know. The code isn't great but, hey, I'm quite new to Rails.


Ok, so no red flags in your code. So, back to a Dreamhost misconfiguration.

I'm getting nowhere wit this problem. Have asked Dreamhost tech support and all they can say is there must be a problem with the code. I just don't get it.

OK, so I try to access the login pages of my site at work where the interconnection is NOT wireless but wired. It all seems ok, on both MS IE and Firefox, under Windows. I go home to my wireless network and I have the octet-stream problem. I then connect my PC to my router using an ethernet cable (not wireless) and I managed to logon, logout and keep doing that about 10 times. I only had the problem once during those times. I'm wondering if the redirect information is occasionally getting lost and thus resulting in the error? A friend of mine also tried. He has a wireless network and the problem only occurred once or twice.

Ok, so you understand that you now sound insane to everyone else :)

I'm back to asking whether you can setup two other pages that do the same thing but are not admin pages, so we can take a look directly.

I realise that I sound insane. It's driving me insane! :-)

Well, I've not setup any separate pages but I see no reason for not giving out my admin page. I have no content of any use at the moment on the site because of this problem so I'm not going to lose anything. The login page can be found at http://www.96methods.com/account/login. There is a dummy user with username of 'test' and password of 'password'.

Any help would be gratefully received.


15 Posts
Login to add your message