Hi all,

My application has the ability to launch per-client Jupyter Notebooks in
Docker containers and maintains a mapping from the client's session
(cookie) to their Jupyter container's port. It then starts up a proxy
application written in Node.js to allow clients to access their containers.
The proxy application listens on its own port, although in production
deployments, both uWSGI and the proxy are proxied by nginx, which serves
the application at / and the proxy at /proxy on a single port.

I am trying to replicate this behavior purely in a single instance of uWSGI
(without emperor) and currently everything works, except that when you
access Jupyter via /proxy, requests to paths outside of /proxy are also
proxied to Jupyter (instead of sent to the application). Only requests with
the session cookie that accessed /proxy see this behavior, other clients
continue to be able to access the application as usual. After around a
minute of not making requests to /proxy, everything returns to normal and
requests outside /proxy are again delivered to the application.

The key seems to be the use of offload-threads: if enabled (any number),
this behavior occurs. If not enabled, the proxy works, albeit very slowly,
and requests to paths outside /proxy continue to be delivered to the
application as intended.

My configuration is here:
https://gist.github.com/natefoo/be55129d68517d80681a5038f048c926

In summary:

Application at /
Proxy at /proxy

1. Client requests /, request is handled by application
2. Client launches Jupyter Notebook via application and requests
/proxy/jupyter/ipython/tree, request is proxied to Jupyter
3. Client requests /, request is proxied to Jupyter
4. Client requests / again after waiting ~1 minute, request is handled by
application

Thanks,
--nate
_______________________________________________
uWSGI mailing list
uWSGI@lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to