Skip to content

Instantly share code, notes, and snippets.

@jpillora
Created May 10, 2015 08:38
Show Gist options
  • Select an option

  • Save jpillora/45b9ce93a74a168a53cf to your computer and use it in GitHub Desktop.

Select an option

Save jpillora/45b9ce93a74a168a53cf to your computer and use it in GitHub Desktop.

Revisions

  1. jpillora created this gist May 10, 2015.
    25 changes: 25 additions & 0 deletions go-get-gitlab-ssh-nginx
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    location / {
    ## check for goget AND /namespace/project
    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='git.axon$uri git ssh://[email protected]:2200$uri.git' name='go-import'></head></html>";
    }
    ## https://github.com/gitlabhq/gitlabhq/issues/694
    ## 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 out to docker host, which maps back into gitlab
    proxy_pass http://gitlab.mycompany.com:10080;
    }