Welcome! Log In Create A New Profile

Advanced

Problem with proxies, redirections and headers

Gautier DI FOLCO
September 28, 2012 09:18AM
Hi all,

I have to set up an infrastructure that allows the dynamic management of SCM
repositories (svn/git, creation/destruction, authentication via MySQL,
clone/checkout, pull/update, push/commit).

This is the way a query that I wanted to set up: nginx receives a request,
#1 matches, request goes to daemon authentication (I use Rack
https://github.com/rack/rack/), it ask for an username and a
password (Basic Auth), check the permissions and send the url to execute and
to return to the client via X-Accel-redirect (yet it does nothing but
redirect)
[configuration is below and is called auth.ru], nginx get the request and
match #2, then it forwards to grack (https://github.com/puzzle/grack/) and
will treat all back to the client. Currently my authtification system works
well (i.e. it redirects to the correct url), the daemon grack, when accessed
directly, handles correctly the requests of Git clients, but when I try to
give
them via nginx, the Content-type header returned to the client is
text/plain,
this is not those returned by grack. Here's my setup, I made a mistake but
I do
not see why.
Do you have any idea?


For your help,
In advance,
Thanks.

# nginx.conf
location ~ /(svn|git)/(.*)$ { #1
proxy_pass http://127.0.0.1:8000/$1/$2;
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;

}

location ~ /_git/(.*) { #2
internal;
proxy_pass http://127.0.0.1:8001/$1;
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;

}

# auth.ru
run lambda { |env|
dir = Rack::Request.new(env).path_info
dir.slice!(0)
dir = '/_' << dir
[200, {"Content-Type" => ".", 'X-Accel-Redirect' => dir}, []]
}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Problem with proxies, redirections and headers

Gautier DI FOLCO September 28, 2012 09:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 256
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready