I have a site built on rails 2 and I want to put into production with Apache 2 + mod_proxy + mongrel instances.
The problem is that, when I hit a non existing page, I expected mongrel to render the /404.html file for me. Since this did't work, I put the "ErrorDocument /404.html" on my Apache 2 config but Apache seems to ignore it, since mongrel answers 404 with some HTML content (with the failing routing match).
Can you help me with this? I expected that mongrel rendered /404.html and /500.html as soon as I indicated I'm in production environment. Is this a mongrel responsibility or Apache?
The ideal configuration most of the time is to have Apache serve all
static files and have mongrel serve the dispatch.rb/cgi/fcgi file.
You need to configure apache to say "if there is no matching file proxy
to mogrel"
then have your app say "if route not found redirect_to '/404'
start with your app:
there is a rescue method for controllers (check the api for the name) i
believe its called "rescue_action" were you can say "if route not found
redirect else call the super" in your application controller
I was using exception_notification plugin, and the problem was that exception_notifiacation looks at the requests from the Apache (proxy) as local (yah.. he's right..)
The solution was to include in app/controllers/application.rb:
after "include ExceptionNotifiable"
local_addresses.clear