无法连接到内核,HTTP 400 代码

Val*_*Tol 6 apache ssl ipython

我正在尝试在我自己的服务器上设置 IPython 笔记本服务器。安装工作正常(我从github源代码3.0.0编译并安装)。

我成功地设置了基本的 HTTP 连接,并且笔记本电脑可以工作。

然而,从那时起,我做了两件事: - 我切换到 ssl (生成自签名证书)和 https (通过 http 的 apache 重定向强制执行) - 我在 apache 中添加了带有代理的重定向,以拥有 subdomain.domain.com指向domain.com:8888

我可以正常连接到服务器,列出笔记本,然后打开一个。但笔记本电脑无法连接到内核,状态为“正在重新连接”,并且我无法运行任何单元。

这是相关的apache配置

<VirtualHost *:80>
    ServerName sub.domain.com
    ServerAdmin admin@domain.com
    Redirect / https://sub.domain.com/
</VirtualHost>
<VirtualHost *:443>
    SSLEngine On
    SSLProxyEngine On
    SSLCertificateFile /etc/ssl/certs/ssl-cert-ipython.crt
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-ipython.key
    ServerName sub.domain.com
    #ServerAdmin admin@domain.com
    ErrorLog ${APACHE_LOG_DIR}/ipython-error.log
    CustomLog ${APACHE_LOG_DIR}/ipython-access.log combined
    ProxyPreserveHost On
    # setup the proxy
    #<Proxy *>
    #    Order allow,deny
    #    Allow from all
    #</Proxy>
    ProxyPass / https://localhost:8888/
        #retry=1 acquire=3000 timeout=600 Keepalive=On
    ProxyPassReverse / https://localhost:8888/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这是 ipython 的示例会话:

...
[I 17:02:51.383 NotebookApp] 0 active kernels
[I 17:02:51.383 NotebookApp] The IPython Notebook is running at: https://[all ip addresses on your system]:8888/
[I 17:02:51.383 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 17:03:04.701 NotebookApp] Kernel started: bb4905f6-d883-4efc-9282-869f098d2b22
[W 17:03:04.948 tornado.access] 400 GET /api/kernels/bb4905f6-d883-4efc-9282-869f098d2b22/shell (::1) 0.31ms referer=None
[W 17:03:10.110 tornado.access] 400 GET /api/kernels/bb4905f6-d883-4efc-9282-869f098d2b22/shell (::1) 0.27ms referer=None
[W 17:03:15.278 tornado.access] 400 GET /api/kernels/bb4905f6-d883-4efc-9282-869f098d2b22/shell (::1) 0.82ms referer=None
[W 17:03:20.505 tornado.access] 400 GET /api/kernels/bb4905f6-d883-4efc-9282-869f098d2b22/shell (::1) 0.51ms referer=None
Run Code Online (Sandbox Code Playgroud)

使用 --debug 时,每秒都会弹出这样的行:

[D 17:02:22.545 NotebookApp] Polling kernel...
Run Code Online (Sandbox Code Playgroud)

编辑:摆弄之后,如果我明确指定端口(使用另一个配置),我设法使其工作,但没有子域前缀。所以看来问题出在代理上。

感谢大家花时间阅读本文!