harbor 加固 修改默认的前端路径

2025-01-04  本文已影响0人  akka9

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;
    }



上一篇 下一篇

猜你喜欢

热点阅读