Last active
August 7, 2018 13:38
-
-
Save iamtakingiteasy/7cbc6e4baae5a9ff3aa879fa3789c8e1 to your computer and use it in GitHub Desktop.
Example nginx reverse-proxy configuration to work-around GitLab hostility to go get utility in case of private groups/projects.
This file contains hidden or 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
| location @proxy-gitlab { | |
| allow all; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Forwarded-Host $host; | |
| proxy_set_header X-Forwarded-Server $host; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header X-Forwarded-Proto $scheme; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| client_max_body_size 20m; | |
| client_body_buffer_size 128k; | |
| proxy_pass http://127.0.0.1:3000; | |
| } | |
| location / { | |
| try_files $uri @proxy-gitlab; | |
| } | |
| location ~ ^/((your_private_group1|your_private_group_2|some_another_private_group|some/nested/groups)/[^/]*).*$ { | |
| if ($query_string = "go-get=1") { | |
| return 200 '<html><head><meta name="go-import" content="$host/$1 git ssh://git@$host/$1.git" /></head></html>'; | |
| } | |
| try_files $uri @proxy-gitlab; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This config has been successfully tested