Nginx在子目录反向代理jupyter-lab的配置方法?

参考gotify的subpath配置

尝试Nginx在子目录反向代理jupyter-lab,失败显示 301 Moved Permanently

请问修改配置文件的哪里呢

我的配置是:

upstream jupyter {
server 127.0.0.1:9999;
}

server {
listen 80;
server_name _;

location /jupyter/ {
proxy_pass http://jupyter/;
rewrite ^ $1 permanent;
proxy_http_version 1.1;

# Ensuring it can use websockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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 http;
proxy_redirect http:// $scheme://;

# The proxy must preserve the host because gotify verifies the host with the origin
# for WebSocket connections
proxy_set_header Host $http_host;

proxy_connect_timeout 7m;
proxy_send_timeout 7m;
proxy_read_timeout 7m;
}

邀请回答
提问于 2021-09-05 08:43
50 次浏览
共1个回答

发表评论
  • 罗剑锋
    2021-09-06 12:27

    感觉应该是rewrite ^ $1 permanent;这个是301永久重定向,发生在rewrite阶段,先于content阶段的proxy_pass。

    0
    回复
    举报
提问者

暂无个人介绍

  • 0

    文章

  • 0

    粉丝

  • 0

    被赞

按Enter键发送
您已邀请位用户
版权所有©F5 Networks,Inc.保留所有权利。京ICP备16013763号-5