Fabien Penso

I'm Fabien, and this is my blog. I'm a Coder, and a photographer. I also enjoy travels.

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 :)

Github Twitter Facebook LinkedIn RSS