diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index fa6aecb66619b00f3a8af5fd08901551e9609a3a..ccf8df33714e62af7d081ffe74931eb1d9ceaa9d 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -1,12 +1,5 @@ %head %meta{charset: "utf-8"} - - -# Go repository retrieval support - -# Need to be the fist thing in the head - -# Since Go is using an XML parser to process HTML5 - -# https://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-45397555 - - if controller_name == 'projects' && action_name == 'show' - %meta{name: "go-import", content: "#{@project.web_url_without_protocol} git #{@project.web_url}.git"} %meta{content: "GitLab Community Edition", name: "description"} %title diff --git a/lib/support/nginx/gitlab b/lib/support/nginx/gitlab index c8b769ace8e0bdce9ed5f32c7d15390786d3932a..80827150bee7a030a713a0a48ba8e42936449857 100644 --- a/lib/support/nginx/gitlab +++ b/lib/support/nginx/gitlab @@ -56,6 +56,16 @@ server { try_files $uri $uri/index.html $uri.html @gitlab; } + ## If ``go get`` detected, return go-import meta tag. + ## This works for public and for private repositories. + ## See also http://golang.org/cmd/go/#hdr-Remote_import_paths + if ($http_user_agent ~* "Go") { + return 200 " + + + "; + } + ## If a file, which is not found in the root folder is requested, ## then the proxy passes the request to the upsteam (gitlab unicorn). location @gitlab { diff --git a/lib/support/nginx/gitlab-ssl b/lib/support/nginx/gitlab-ssl index 4e53d5e8b50b1660d8ef328dd4593a194dc6ec33..7fb4d568d21daa0cba9ae48d81ae54e066c54298 100644 --- a/lib/support/nginx/gitlab-ssl +++ b/lib/support/nginx/gitlab-ssl @@ -101,6 +101,16 @@ server { try_files $uri $uri/index.html $uri.html @gitlab; } + ## If ``go get`` detected, return go-import meta tag. + ## This works for public and for private repositories. + ## See also http://golang.org/cmd/go/#hdr-Remote_import_paths + if ($http_user_agent ~* "Go") { + return 200 " + + + "; + } + ## If a file, which is not found in the root folder is requested, ## then the proxy passes the request to the upsteam (gitlab unicorn). location @gitlab {