From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.66.173.235 with SMTP id bn11csp30423pac; Wed, 26 Sep 2012 12:35:24 -0700 (PDT) Return-Path: Received-SPF: pass (google.com: domain of rack-devel+bncBC46574IWAHBB65RRWBQKGQET5PYSHQ@googlegroups.com designates 10.229.135.213 as permitted sender) client-ip=10.229.135.213 Authentication-Results: mr.google.com; spf=pass (google.com: domain of rack-devel+bncBC46574IWAHBB65RRWBQKGQET5PYSHQ@googlegroups.com designates 10.229.135.213 as permitted sender) smtp.mail=rack-devel+bncBC46574IWAHBB65RRWBQKGQET5PYSHQ@googlegroups.com; dkim=pass header.i=rack-devel+bncBC46574IWAHBB65RRWBQKGQET5PYSHQ@googlegroups.com Received: from mr.google.com ([10.229.135.213]) by 10.229.135.213 with SMTP id o21mr604058qct.5.1348688124268 (num_hops = 1); Wed, 26 Sep 2012 12:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-beenthere:date:from:to:message-id:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=EmKzo/Jommuw1mbMkL3ZVlCqjwh3lOEsUMGAm093Pf8=; b=xqAOByVRBhVLDA8xUNptjxeoICs8bkmNqHLEOSpE5z3xuA8k6NTVKM/M4V3+/841iL BD3ggDZpgPX1XTJSrr4mVvUtKh3zfKsxyMj4BE0s+yDU9ilNeYGCIVDujWo6vgzRvfId VZzPd/JXybWSTTcuRDOuixROoy6jP7WZSXAev3YSauXWZnqW1rrjwG67ymwo/5Kt3199 /92nDIskCm4Z0bzzY7SxtA5z7P7+CGPIOOVoIgmariJ0gIFtWkXpsTQHvfCaQQDZfdSS AqvMUWEBvC9MX7z4lDeovSicC11V+iti+b82cCVW+o2v8FdjR3SFE7kNfUQ9976Vojts gjaA== Received: by 10.229.135.213 with SMTP id o21mr211126qct.5.1348688123727; Wed, 26 Sep 2012 12:35:23 -0700 (PDT) X-BeenThere: rack-devel@googlegroups.com Received: by 10.229.176.150 with SMTP id be22ls2882831qcb.4.gmail; Wed, 26 Sep 2012 12:35:23 -0700 (PDT) Received: by 10.224.70.131 with SMTP id d3mr1382460qaj.0.1348688123201; Wed, 26 Sep 2012 12:35:23 -0700 (PDT) Received: by 10.224.184.14 with SMTP id ci14msqab; Wed, 26 Sep 2012 06:32:29 -0700 (PDT) Received: by 10.224.110.204 with SMTP id o12mr305215qap.6.1348666349726; Wed, 26 Sep 2012 06:32:29 -0700 (PDT) Date: Wed, 26 Sep 2012 06:32:29 -0700 (PDT) From: Black To: rack-devel@googlegroups.com Message-Id: <6251f00b-686b-4e21-96b9-cb39cd73018f@googlegroups.com> Subject: Rack::Sendfile and Rack::Auth tiny example MIME-Version: 1.0 X-Original-Sender: gautier.difolco@gmail.com Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: X-Google-Group-Id: 486215384060 List-Post: , List-Help: , List-Archive: Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: multipart/alternative; boundary="----=_Part_1894_14605334.1348666349316" ------=_Part_1894_14605334.1348666349316 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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. ------=_Part_1894_14605334.1348666349316 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi all,


I'm new to rack, I use nginx as reverse proxy for many s= ervices, I want to setup a global authentification on my site based on MySQ= L.
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, the= n it use Sendfile to tell to Nginx which page to serve
Nginx take the re= quest and route to the good service.

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

I try this :
=
  location / {
    proxy_pass   &= nbsp;     http://127.0.0.1:8008/;
   = proxy_redirect     off;

    prox= y_set_header   Host       &nbs= p;        $host;
    p= roxy_set_header   X-Real-IP      &n= bsp;    $remote_addr;
    proxy_set_header=    X-Forwarded-For     $proxy_add_x_forwarded= _for;

    proxy_set_header   X-Sendfile-Typ= e     X-Accel-Redirect;

  }

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


use Rack::Auth::Basic, "Authentificat= ion" do |username, password|
    next username =3D=3D pas= sword

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.
------=_Part_1894_14605334.1348666349316--