harbor默认前端路径为 / ,可以把它改为 其他路径。
location / {
proxy_pass http://portal/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
proxy_cookie_path / "/; HttpOnly; Secure";
proxy_buffering off;
proxy_request_buffering off;
}
改为 :
location /harbor {
proxy_pass http://portal/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
proxy_cookie_path / "/; HttpOnly; Secure";
proxy_buffering off;
proxy_request_buffering off;
}
location / {
rewrite /(.*\.css.*) https://$http_host:443/harbor/$1 permanent;
rewrite /(.*\.js.*) https://$http_host:443/harbor/$1 permanent;
rewrite /(.*\.svg.*) https://$http_host:443/harbor/$1 permanent;
#rewrite /(account.*) https://$http_host:443/harbor/$1 permanent;
}