通过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
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/101179.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...