Rc4 upgrade issue

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…

2005/11/7, Sean T Allen [email protected]:

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

Francois B. wrote:

end
should instead do this:
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.

2005/11/8, Sean T Allen [email protected]:

Francois B. 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

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 [email protected]:

Francois B. wrote:

false
production - local_request? always returns false, no ?
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

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

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 local_request?
# 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 [email protected] wrote:

class ApplicationController < ActionController::Base

mod_security etc etc etc


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Frank K.
http://meetingkoreans.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.