nginx使用反向代理时,通过master节点IP访问node节点的jupyter,需要额外配置
jupyter 使用了 websocket 协议,所以需要配置支持 websocket。
# server前先加一段配置,websocket client请求头自带http_upgrade,映射成connection_upgrade
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 8030;
location / {
proxy_pass http://10.88.222.52:8111;
# 启用支持websocket连接,nginx的功能
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
}
}
网友评论