Friday, June 24, 2022

[FIXED] How to run jupyter notebook behind haproxy and make its content public?

Issue

How to run jupyter notebook behind haproxy? I tried to find an answer on the Internet but there are solutions only for Ngix and Apache and I think that using haproxy as a reverse proxy can be even a simple solution that does not involve creating special Virtual servers.


Solution

The following solution run successfully and also does load balancing.

Assuming that you have a site jupyter.example.com the following code inserted in the /etc/haproxy/haproxy.cfg will solve your problem of making the jupyter notebook public:

backend jupyter
        option forwardfor
        http-request set-header X-Client-IP %[src]
        reqrep ^([^\ :]*)\ /mez/(.*) \1\ /\2
        reqadd X-Script-Name:\ /jupyter
        option http-server-close
        server Server12 10.0.0.12:8888 weight 40 check
        server Server14 10.0.0.14:8888 weight 20 check


Answered By - Bogdan
Answer Checked By - Clifford M. (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.