96 methods

Getting Hosted

I had a number of problems getting this site up and running with my host at first. I don't know what problems I'm going to encounter in the future but, at the moment, those problems have all been fixed and all is working well.

Don't know how the site will cope if people ever add any comments to my posts! The site was working well on my local PC but there were a number of issues to be resolved when the site finally got uploaded to my host.

For the first problem that I encountered I was getting an Application Error page whenever I viewed my site in a browser but my dispatch.fcgi file was working fine at the command prompt. The error.log file was reporting an incomplete header problem. After a little reading up on the DreamHost wiki page I found some information relating to this in the 'Common Gotchas' section under Symptom 1.2. Some time's passed since that first problem and I cannot recall exactly what I discovered but I followed the recommendation detailed in the wiki and this solved the problem. The solution was to change the 'group' of all of my files back to the default group.

The second problem related to the will_paginate gem. This is a pagination solution that I use to paginate post and news information on the administration pages of my site. I discovered that there were no problems if I commented out the require 'will_paginate' entry from my environment.rb file but if I put it back in it didn't seem to recognise the gem. I looked again at the Rails page of the DreamHost wiki and found the solution. The solution was to add the following line to my environment.rb file:

config.load_paths += %W( #{RAILS_ROOT}/vendor/will_paginate-2.2.2/lib )

I'm not sure why the gem wasn't being added to the gem load path but I got the result I needed. The final problem was obscure, at least it seemed that way to me. When I attempted to login to the admin section of my site and clicked the Login button I would get a dialogue box appearing which essentially meant that the browser wasn't receiving valid data.

Firefox would show a dialogue box saying something like, "You have chosen to open blog which is a: BIN file" ('blog' being the name of the page that I was attempting to access). Internet Explorer would show a dialogue which mentioned an application/octet-stream issue. The confusing thing was that this didn't happen all of the time. It seemed to happen in both of those browsers that I've mentioned and occurred on Windows and on Linux (Ubuntu). However, I didn't realise that this was a clue at the time, when I tried to log in to my site from my place of work everything was successful. I continued to put up a few posts on Rails specific forums and the DreamHost forum. The help came from the Working with Rails forum. Two of the guys who responded to my post seemed to think that it sounded like a server configuration problem, saying that my code seemed fine. One thing to mention is that the problem related to a redirect_to call; this was where the problem was revealing itself.

Now thinking that there was a server configuration problem I raised a help ticket with DreamHost to get the problem looked at. Unfortunately they were convinced that it was my code that was causing the problem, and of course they're not going to help someone debug their code so that was that. I was back to square one.

It was at this point that I decided to investigate a little further from my side. I asked a friend to access the site and tell me if he encountered the same problems that I was having. He did have the same problem. He was accessing the internet via a wireless connection, and so was I. I decided to connect my PC directly to my router, thereby using a wired connection rather than a wireless connection. The result was that for something like 9 attempts out of 10 to log in to my site it was successful, I didn't get the problem.

I went back to the Working with Rails forum and added to the growing post, telling them about my experience with the wired and wireless connections. That's when one of the guys contributing to the forum found the problem. It was related to the automatic gzip encoding that was taking place on the DreamHost server. Basically the gzip encoding was occurring if I accessed the site with a slow connection (my home network, especially with the wireless router) but encoding was not happening if the site was accessed with a fast connection (my work network). I raised another help ticket with DreamHost asking them to switch off gzip encoding and all is now well.

Phew! That was a bizarre problem that I would have been unable to fix without the help from the forums. So many thanks go to Jason King. If it wasn't for your help I'd still be struggling with this issue now.

Here's a link to the discussion at the Working with Rails site for anyone who's interested.

Posted by Graham Blake on 28th February 2009 at 07:21

Comments

Write a Comment

Categories

Feedback

Drop me an email.