[IPython-dev] IPython notebook+nginx proxy+ssl+websockets

Kyle Kelley rgbkrk at gmail.com
Fri Aug 23 18:45:47 EDT 2013


Hey all,

Has anyone gotten nginx proxying to work when using ssl? I started off with
MinRK's nginx config (https://twitter.com/minrk/status/329376092420993024),
adding on to it like so:

server {
    listen 80;
    rewrite        ^ https://$host$request_uri? permanent;
}

server {
    listen 443;
    ssl on;
    ssl_certificate /etc/nginx/ssl/cert.pem;
    ssl_certificate_key /etc/nginx/ssl/cert.key%>;

    error_log /var/log/nginx/error.log;

    location ^~ /static/ {
        alias
/home/ipynb/ipyvirt/lib/python2.7/site-packages/IPython/html/static/;
    }

    location / {
      proxy_pass http://localhost:9999;

      #proxy_set_header X-Real-IP $remote_addr;
      #proxy_set_header Host $http_host;
      #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

      #proxy_set_header X-NginX-Proxy true;

      # WebSocket support
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_read_timeout 86400;

   }
}

Most of the proxying works just fine, but websockets fail. I could host
this using the certfile and keyfile setting in IPython (and not use nginx),
but was hoping to proxy from some high port by a non-privileged user to
port 443 (with a redirect from 80).

-- Kyle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130823/16f6d0b8/attachment.html>


More information about the IPython-dev mailing list