Skip to content

Instantly share code, notes, and snippets.

@iamtakingiteasy
Last active August 7, 2018 13:38
Show Gist options
  • Select an option

  • Save iamtakingiteasy/7cbc6e4baae5a9ff3aa879fa3789c8e1 to your computer and use it in GitHub Desktop.

Select an option

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.
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;
}
@apodoplelov
Copy link
Copy Markdown

This config has been successfully tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment