go mod 在使用私有gitlab时“go-get=1”错误解决

go mod 在使用私有gitlab时“go-get=1”错误解决

通过nginx转发解决:

server{
        listen 80;
	listen 443 ssl;
	server_name gitlab.data-spark.cn;

	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='gitlab.data-spark.cn/$1/$2 git http://gitlab.data-spark.cn/$1/$2.git' name='go-import'></head></html>";
	}

	ssl on;
        ssl_certificate /etc/nginx/conf.d/ssl/gitlab.data-spark.cn_bundle.crt;
        ssl_certificate_key /etc/nginx/conf.d/ssl/gitlab.data-spark.cn.key;

	ssl_protocols               TLSv1 TLSv1.1 TLSv1.2;
	ssl_prefer_server_ciphers   on;

	ssl_ciphers                 EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;

	# avoid ssl stripping
	add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";

	location / {
        proxy_pass http://localhost:18080/;
	}

	error_page 497  https://$host$uri?$args;
}

加入了

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='your.domain.com/$1/$2 git http://your.domain.com/$1/$2.git' name='go-import'></head></html>";
}

转载于:https://my.oschina.net/Kanonpy/blog/3000411

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/101179.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号