Hi all,


I'm new to rack, I use nginx as reverse proxy for many services, I want to setup a global authentification on my site based on MySQL.
I think at this schema:
Nginx pass the request to my auth (a Rack service :8008)
:8008 use its Auth module to authentificate the user, then it use Sendfile to tell to Nginx which page to serve
Nginx take the request and route to the good service.

I haven't found any documentation on my problem (especially on the Sendfile part).

I try this :

  location / {
    proxy_pass         http://127.0.0.1:8008/;
    proxy_redirect     off;

    proxy_set_header   Host                $host;
    proxy_set_header   X-Real-IP           $remote_addr;
    proxy_set_header   X-Forwarded-For     $proxy_add_x_forwarded_for;

    proxy_set_header   X-Sendfile-Type     X-Accel-Redirect;

  }

And :
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/lib')

use Rack::ShowExceptions


use Rack::Auth::Basic, "Authentification" do |username, password|
    next username == password

end

use Rack::Sendfile
run lambda { |env| [200, {}, []] }

But it fails, have you got a tiny example which should work?

For your help,
In advance,
Thanks.