Random Thoughts by Fabien Penso

Rails, Apache on front, lighttpd behind

I needed to use Apache on front because its mod_gzip plugin works pretty well and is efficient. Lighttpd doesn’t compress anything that ain’t static pages.

If you use that mode, rails will see requests coming from 127.0.0.1 and will keep displaying Routing error and not 404 pages even in production mode (rails does that for local request by default).

You’ll want to switch that off with the following piece of code. Paste it into the application_controller.rb file :


module ActionController
  module Rescue
    def local_request?
      false
    end
  end
end

And voilà, you have your usual 404 errors :)