User-friendly error pages not displaying in production environment
Asked Answered
C

1

4

Recently my user friendly error pages stopped displaying for my production environment. I am using rails 3.0.3.

I have the following in my config/environments/production.rb:

config.action_controller.consider_all_requests_local = false

When I start my web server locally using the production environment, the user-friendly error pages display properly.

Has anyone else experienced this?

Calmas answered 4/1, 2011 at 22:9 Comment(1)
The other criteria for showing the errors is request.local? which compares the remote ip address to 127.0.0.1 (and a few others but that's the gist of it). If you're behind a proxy, Rails does something with the action_dispatch.remote_ip environment variable to accomplish the same thing. If you can get a dump of the request environment it might help.Evoy
D
5

I found a fix for this thanks to Scott at EngineYard

I put this at the beginning of my config/environments/production.rb

class ActionDispatch::Request
 def local?
   false
 end
end
Devoice answered 5/1, 2011 at 17:1 Comment(1)
great stuff, you saved me some headace :pOberg

© 2022 - 2024 — McMap. All rights reserved.