我在 GKE 上有一个 Kubernetes 集群,上面有一个 nginx 入口控制器,用于映射 /rstudio/ 下的 RStudio Server 端点。这工作得很好。
不幸的是,我的一个部署(RStudio Server)无法正常工作,因为它在登录/注销期间使用客户端重定向,在尝试访问 /auth-login 时最终出现 404 错误(应该是 /rstudio/auth-登录)
过去,当使用 RStudio Server 的非容器化安装时,我曾经在前面放置一个 Apache 反向代理来处理 url 重写。
从官方的 RStudio Server Pro 指南中,我看到添加此location
部分nginx.conf
应该可以解决问题。
location /rstudio/ {
rewrite ^/rstudio/(.*)$ /$1 break;
proxy_pass http://localhost:8787;
proxy_redirect http://localhost:8787/ $scheme://$host/rstudio/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
}
我可以在入口控制器上使用注释来获得相同的结果吗?