-
-
Save lopesivan/10646779 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This config requires the HTTP Auth Request module | |
# http://mdounin.ru/hg/ngx_http_auth_request_module/ | |
set $chiliproject_key "supersecret"; | |
# set write permission to commit_access | |
set $chiliproject_permission "commit_access" | |
location ~ "^/sys/projects/[^/]/auth(/.*)?" { | |
# Clean up the request to please the http_auth_request module. | |
proxy_pass_request_body off; | |
proxy_set_header Content-Length ""; | |
} | |
######################################################################## | |
# SUBVERSION | |
######################################################################## | |
# if we have a read-only request, check browse_repository instead | |
if ( $request_method =~ "GET|HEAD|PROPFIND|REPORT|OPTIONS" ) { | |
set $chiliproject_permission "browse_repository"; | |
} | |
location ~ "^/svn/([^/]+)" { | |
set $project $1; | |
auth_request /sys/projects/$project/auth?key=$chiliproject_key&permission=$chiliproject_permission; | |
} | |
######################################################################## | |
# GIT | |
######################################################################## | |
# if we have a read-only request, check browse_repository instead | |
location ~ "^/git/([^/]+)/*[^/]+/+(info/refs\?service=)?git\-receive\-pack$" { | |
set $chiliproject_permission "browse_repository"; | |
} | |
location ~ "^/git/([^/]+)" { | |
set $project $1; | |
auth_request /sys/projects/$project/auth?key=$chiliproject_key&permission=$chiliproject_permission; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment