Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gitlab go get via SSH
server {
listen {PUBLIC-GITLAB-HTTP-PORT}; #e.g. 80
server_name {PUBLIC-GITLAB-HOST}; #e.g.
# add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
location / {
## Hack to implement && - Concat two strings and compare result
if ($args ~* "^go-get=1") {
set $condition goget;
if ($uri ~ ^/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$) {
set $condition "${condition}path";
if ($condition = gogetpath) {
return 200 "<!DOCTYPE html><html><head><meta content='{PUBLIC-GITLAB-HOST}$uri git ssh://git@{PUBLIC-GITLAB-HOST}:{PUBLIC-GITLAB-SSH-PORT}$uri.git' name='go-import'></head></html>";
## Some requests take more than 30 seconds.
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
# Proxy to gitlab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.