You are here: Forums Ask a Rails expert redirect_to failing at Dreamho...
Posted in Forums : Ask a Rails expert
Authority 0
Posting Rating 31
Sign in to rate this post
|
Hi 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. Thanks Graham |
Authority 62
Posting Rating 100
Sign in to rate this post
|
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 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. |
|
Authority 25
Posting Rating 97
Sign in to rate this post
|
Agree with “it sounds like a server misconfiguration”. Try to append |
Authority 0
Posting Rating 31
Sign in to rate this post
|
Thanks guys. I’ll make those controllers available in a little while. |
Authority 0
Posting Rating 31
Sign in to rate this post
|
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. |
Authority 62
Posting Rating 100
Sign in to rate this post
|
Ok, so no red flags in your code. So, back to a Dreamhost misconfiguration. |
Authority 0
Posting Rating 31
Sign in to rate this post
|
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. |
Authority 0
Posting Rating 31
Sign in to rate this post
|
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. |
Authority 62
Posting Rating 100
Sign in to rate this post
|
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. |
Authority 0
Posting Rating 31
Sign in to rate this post
|
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. Thanks |
Authority 0
Posting Rating 31
Sign in to rate this post
|
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. Thanks |
Authority 0
Posting Rating 31
Sign in to rate this post
|
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. Thanks |
Authority 62
Posting Rating 100
Sign in to rate this post
|
Ok, it’s definitely your (their) webserver that’s broken. It’s to do with the auto gzip encoding which the web server is doing with the content, and the Content-Length header. Here’s a pastie showing my wget sessions with your server: http://pastie.org/392650 Hopefully the comments in the pastie explain what the problem is, basically your server is reporting the original unzipped filesize as the Now for the bit which explains your insanity – web servers detect through some sort of black magic that I don’t know about – the network latency of the client they’re responding to, and based on this they decide whether it’s worthwhile gzipping content or not. For fast connections, they don’t bother because the overhead of gzipping isn’t worth the small transfer improvement, but for slower connections they do the gzipping thing. I guess that having the wifi in the mix causes the network latency algorithm to be triggered and so the server is gzipping the content for your wifi connection, but sending it uncompressed when you’re connected directly. So, not insane at all. Btw, you can confirm all this by switching off the gzip encoding method in your browser, not sure about others but in firefox if you put |
Authority 0
Posting Rating 31
Sign in to rate this post
|
Jason, that’s fantastic. Thankyou VERY much for your assistance and time. It’s much appreciated. My first thought was what do I need the Dreamhost tech. support people to actually do to resolve this problem. What can I get them to do, what do I need to spell out to them? But I wonder if there’s anything I can do, perhaps to my .htaccess file or even switch gzipping off perhaps? Thanks again Graham |
Authority 62
Posting Rating 100
Sign in to rate this post
|
After a bit of googling, I found that You can switch off the deflating in .htaccess – I think it’s:
|
Ask a Rails expert : How to Prevent double space being converted into " " fckeditor
Ask a Rails expert : Random Issue with Invalid AuthenticityToken
Ask a Rails expert : Apache + Passenger -> RoR hates me!
Ask a Rails expert : which one i choose .net or ror
Ask a Rails expert : Tinymce 3.3.2
Ask a Rails expert : how do you organize javascript code in your rails project?
Ask a Rails expert : Custom Browse button in IE6(can not submit form)
Ask a Rails expert : gem install mysql issue
Ask a Rails expert : how to provide href in alert message
Ask a Rails expert : desert routes not running properly