Welcome Guest | Login

Stylesheet Issues w Rails Application

Hi,

Every once in a while my sites stop loading their stylesheets and end up looking like outlines of pages. I don't understand why. They will do this for up to an hour(was the longest time I remember) and then just start displaying properly again without any intervention from me.

Does anyone know what could be causing this. It is really frustrating to me and to me clients who use this application quite a bit each day, but it becomes mostly unusable when this is happening.

Also, possible a separate issue but maybe related, on occasion the sites load extremely slow or fail to load at all. Refreshing the page seems to help, but once they are loaded and past the first page everything is fast again.

Thanks for any help provided

2007-07-09 01:47 PM

The second issue you've described is a classic problem with FastCGI in a shared hosting environment (i.e. if it gets killed off it needs to load up again, *then* it is subsequently 'fast')- and why Mongrel is a better alternative. Of course, if your app is on Mongrel, then this could be a different problem.  

The first issue - assuming you're on fastcgi?  do you have custom lines in your .htaccess that might be sending static requests to your dispatchers?  

2007-07-09 02:00 PM

Hi,

Thanks for replying. We are running on FastCGI for this application. We have another application running on a Mongrel Cluster that seems to suffer from the same slowdown issues but it doesn't ever lose it's style sheet. Unfortunately I do not have much Ruby/Rails experience I am taking this project over after one of our other developers moved away. So I am trying to learn exactly what is going on but in my opinion if you reference a style sheet it should stay referenced. In any case this is what we have for .hataccess for the sites. Thanks again for your help.

# General Apache options
# AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
#   Alias /myrailsapp /path/to/myrailsapp/public
#   RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
#   ErrorDocument 500 /500.html

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"

2007-07-09 02:27 PM

Yeah - that looks fine. Hmmm...I've never heard of the problem you're having....if it happens again please open a support ticket with URGENT in the subject line and have a tech take a look so a solution can be found.  Sorry for the trouble. ~William

2007-07-09 04:36 PM

Hello William,

I am having the exact same issue as Bensur explains here.  Should I move from FastCGI to a Mongrel Cluster?

Related forum thread:http://www.hostingrails.com/forums/deployment_troubleshooting_thread/944

Thanks,
Marty

2008-03-07 05:46 PM

: marty mcgee
Marty, we'd like to take a look - can you update us with a URL to the problem?  You can post it through the contact page to support.  This may or may not be related to fastcgi/mongrel.

2008-03-08 01:46 AM

Was there a solution to this problem? I think that I am having the same (or similar) problem :-/

At first the CSS seemed to be loading fine... but now it doesn't load at all.
I can't think of any changes that I may have made that would effect this...

There is nothing unusual (as far as I can see) with my .htaccess file (have only made changes as suggested in the tutorial to get my rails app up and running).

I can access other docs from my public folder (for instance javascripts and images) but files from within the stylesheets are returning a 404 error :-(

I've checked file permissions for these folders (javascripts, images, stylesheets) but they are all the same.

I do have some named routes in my routes.rb, but nothing that I can see would be matching the stylesheets path.

In the mean time I've changed the link to the CSS card to link to a CSS file outside my application, but it would be great to know what I've done wrong :-/

Anyone have any ideas where I might have gone wrong?

2008-03-16 05:54 PM

What does production log say when loading the site on browser ?

I accessed your ain site and subfolders (links) going from public_html and couldn't see any style sheet issues. If you still have this issue, please contact support with exact URL or steps to replicate the problem.  

2008-03-17 12:01 AM

Opps... my bad!

I was getting this error:
ActionController::RoutingError (No route matches "/stylesheets/default.css" with {:method=>:get}):

So it *was* trying to match with routes.rb, and when I looked in my application/public/stylesheets directory it turns out that I hadn't uploaded any stylesheets at all

<grin>

thanks for the point to the right direction!

2008-03-17 12:38 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!