i''ve had the following in my environments/production.rb: module ActionController module Rescue def local_request? false end end end As of RC4, it causes fcgi to die on startup. can someone tell me quickly what changed to cause this and perhaps save me some time digging through the source... _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
2005/11/7, Sean T Allen <sean@ardismg.com>:> i've had the following in my environments/production.rb: > > module ActionController > module Rescue > def local_request? > false > end > end > end > > As of RC4, it causes fcgi to die on startup. > > can someone tell me quickly what changed to cause this > and perhaps save me some time digging through the source...I don't use FCGI myself on my dev machine, but that is wrong. You should instead do this: app/controllers/application.rb class ApplicationController < ActionController::Base protected def local_request? false end end Hope that helps ! François _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Francois Beausoleil wrote:>2005/11/7, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org>: > > >>i''ve had the following in my environments/production.rb: >> >>module ActionController >> module Rescue >> def local_request? >> false >> end >> end >>end >> >>As of RC4, it causes fcgi to die on startup. >> >>can someone tell me quickly what changed to cause this >>and perhaps save me some time digging through the source... >> >> > >I don''t use FCGI myself on my dev machine, but that is wrong. You >should instead do this: > >app/controllers/application.rb >class ApplicationController < ActionController::Base >protected > def local_request? > false > end >end > >Hope that helps ! >François > > > >i only want it when running in production. the code in question that always used to work actually came from DHH quite sometime ago.. its obviusly wrong as of the 1.0 RC candidates but wasnt previously. what you have doesnt however accomplish what i need, i.e. only occurs when running in production. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
2005/11/8, Sean T Allen <sean@ardismg.com>:> Francois Beausoleil wrote: > >app/controllers/application.rb > >class ApplicationController < ActionController::Base > >protected > > def local_request? > > false > > end > >end > > > i only want it when running in production.Actually, if I remember correctly, that is exactly what's happening in production - local_request? always returns false, no ? Actually, I'm not quire right (Rails 0.14.3): def local_request? #:doc: @request.remote_addr == "127.0.0.1" end As long as the request isnt come from 127.0.0.1, you should be fine in production, no ? Hope that helps, François _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Francois Beausoleil wrote:>2005/11/8, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org>: > > >>Francois Beausoleil wrote: >> >> >>>app/controllers/application.rb >>>class ApplicationController < ActionController::Base >>>protected >>> def local_request? >>> false >>> end >>>end >>> >>> >>> >>i only want it when running in production. >> >> > >Actually, if I remember correctly, that is exactly what''s happening in >production - local_request? always returns false, no ? > >Actually, I''m not quire right (Rails 0.14.3): >def local_request? #:doc: > @request.remote_addr == "127.0.0.1" >end > >As long as the request isnt come from 127.0.0.1, you should be fine in >production, no ? > >Hope that helps, >François > >It does come from 127.0.0.1 that is our setup... no requests that dont pass through a frontend server that runs mod_security etc etc etc _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Ah, I better understand now. So, change my original code to this: app/controllers/application.rb class ApplicationController < ActionController::Base protected if 'production' == RAILS_ENV then def local_request? false end end end Class declarations are executable code, so it is possible to build some stuff conditionnally. Hope that helps ! François 2005/11/8, Sean T Allen <sean@ardismg.com>:> It does come from 127.0.0.1 > > that is our setup... no requests that dont pass through a frontend > server that runs > mod_security etc etc etc_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
this isnt working. i still seems to function as tho local request where true throwing in a random url i get: Routing Error Recognition failed for "/ed" instead of the 404.html Francois Beausoleil wrote:>Ah, I better understand now. So, change my original code to this: > >app/controllers/application.rb >class ApplicationController < ActionController::Base > protected > if ''production'' == RAILS_ENV then > def local_request? > false > end > end >end > >Class declarations are executable code, so it is possible to build >some stuff conditionnally. > >Hope that helps ! >François > >2005/11/8, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org>: > > >>It does come from 127.0.0.1 >> >>that is our setup... no requests that dont pass through a frontend >>server that runs >>mod_security etc etc etc >> >> >>------------------------------------------------------------------------ >> >>_______________________________________________ >>Rails mailing list >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >> >>_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I think the problem is because of this which I found in /actionpack-1.11.0/lib/action_controller/base.rb. # All requests are considered local by default, so everyone will be exposed to detailed debugging screens on errors. # When the application is ready to go public, this should be set to false, and the protected method <tt>local_request?</tt> # should instead be implemented in the controller to determine when debugging screens should be shown. @@consider_all_requests_local = true cattr_accessor :consider_all_requests_local This variable is set to false when you are in production mode so I am guessing you are seeing this because your production.rb was not updated to to do this. ./config/environments/production.rb:config.action_controller.consider_all_requests_local = false -Frank On 11/10/05, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org> wrote:> this isnt working. > > i still seems to function as tho local request where true > > throwing in a random url i get: > > > Routing Error > > Recognition failed for "/ed" > > > instead of the 404.html > > > > Francois Beausoleil wrote: > > >Ah, I better understand now. So, change my original code to this: > > > >app/controllers/application.rb > >class ApplicationController < ActionController::Base > > protected > > if ''production'' == RAILS_ENV then > > def local_request? > > false > > end > > end > >end > > > >Class declarations are executable code, so it is possible to build > >some stuff conditionnally. > > > >Hope that helps ! > >François > > > >2005/11/8, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org>: > > > > > >>It does come from 127.0.0.1 > >> > >>that is our setup... no requests that dont pass through a frontend > >>server that runs > >>mod_security etc etc etc > >> > >> > >>------------------------------------------------------------------------ > >> > >>_______________________________________________ > >>Rails mailing list > >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >>http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-- Frank Kim http://meetingkoreans.com http://betweengo.com
I have the problem because i am running lighttpd on 127.0.0.1 which the code from my original post took care of when in production... but it doesnt work anymore... it causes fcgi to crash and Francois'' code doesnt work. Frank Kim wrote:>I think the problem is because of this which I found in >/actionpack-1.11.0/lib/action_controller/base.rb. > > # All requests are considered local by default, so everyone will >be exposed to detailed debugging screens on errors. > # When the application is ready to go public, this should be set >to false, and the protected method <tt>local_request?</tt> > # should instead be implemented in the controller to determine >when debugging screens should be shown. > @@consider_all_requests_local = true > cattr_accessor :consider_all_requests_local > >This variable is set to false when you are in production mode so I am >guessing you are seeing this because your production.rb was not >updated to to do this. > >./config/environments/production.rb:config.action_controller.consider_all_requests_local >= false > >-Frank > >On 11/10/05, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org> wrote: > > >>this isnt working. >> >>i still seems to function as tho local request where true >> >>throwing in a random url i get: >> >> >> Routing Error >> >>Recognition failed for "/ed" >> >> >>instead of the 404.html >> >> >> >>Francois Beausoleil wrote: >> >> >> >>>Ah, I better understand now. So, change my original code to this: >>> >>>app/controllers/application.rb >>>class ApplicationController < ActionController::Base >>> protected >>> if ''production'' == RAILS_ENV then >>> def local_request? >>> false >>> end >>> end >>>end >>> >>>Class declarations are executable code, so it is possible to build >>>some stuff conditionnally. >>> >>>Hope that helps ! >>>François >>> >>>2005/11/8, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org>: >>> >>> >>> >>> >>>>It does come from 127.0.0.1 >>>> >>>>that is our setup... no requests that dont pass through a frontend >>>>server that runs >>>>mod_security etc etc etc >>>> >>>> >>>>------------------------------------------------------------------------ >>>> >>>>_______________________________________________ >>>>Rails mailing list >>>>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>>> >>>> >>>> >> >>_______________________________________________ >>Rails mailing list >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> >> >> >> > > >-- >Frank Kim >http://meetingkoreans.com >http://betweengo.com >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails