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.
Action working with webrick, not with Apache+fastcgi
7 Posts
Action working with webrick, not with Apache+fastcgi


I am desesperate after asking different peole I still have a stange problem that I don't know how to solve.

My application is deployed and configured to use Apache and Fastcgi (I use a hosting company).

It works ok except for some redirect where apparently the wrong route is used. I have tried on the same environment with webrick (with the command script/server) and it works ok. I suspect a problem with Apache configuration but don't know how to diagnose.

Here is the configuration where the problem occurs: I have a remote form which call an action as followed

created_path do |f| -%>

The action created is executed until it reaches the following redirection render :update do |page| page.redirect_to building_blocks_path (@building) end

and instead of going to the index action of the blocks controller it loops on the created action and there is nothing special in the log except - Completed in 0.79187 (1 reqs/sec) | Rendering: 0.00394 (0%) | DB: 0.73004 (92%) | 200 OK [http://int.notreimmeuble.com/created] and a 500 Internal Server Error in the javascript response (with the message in the ErrorDocument 500 in htaccess) (again this same code works well with webrick started on the same environment).

Here is the htaccess used (and recommended by my hoster) AddHandler fcgid-script .fcgi Options +FollowSymLinks +ExecCGI RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

ErrorDocument 500 "< h2>Erreur de l'application</ h2>L'application n'a pas démarré, contacter l'administrateur"

Any advice for a solution would be very welcome Thanks Nicolas

Hi Nicolas,

Have you also made sure that there are no validation errors while it is creating the building record?

Make sure you have error_messages_for(:building) on your "new building" view. Sometimes, it's the littlest things...

HTH, Jason Arora

Hello Jason,

Thanks for your answer. Yes the validation are ok a new building has been created, but the redirect to the next step doesn't occur.


Hi Nicolas, you can attack this in 2 ways: 1) run the application in developemet on the Apache FCGI configurations (i think you only need to change your mongrel_cluster.yml) and install the FireFox extension "FireBug" which enables you to track AJAX requests in your site, watch the "Console" tab on firbug and see why your request was erroneous. (moving to development env is necessary, so you'll get the actual error, and not the 500.htm page like in production). 2) trace your log.

Thanks, I'll give that a try.



I have tried to run in dev mod but it did not change anything, no more trace than the one I had, and the console mode did not give more than the one I gave in my first post.

Any other idea?

I think I have found the problem (thanks to this post (http://lightman76.wordpress.com/2007/06/15/running-ruby-on-rails-with-mod_fcgid-and-apache/) which explained that if you have a puts with mod_fcgi then it screw your program and I had one... Now it works I have stil another problem but this is less critical.

Thanks for your help.


7 Posts
Login to add your message