Not completely there yet, but I at least got the backend server login
screen to come up with the following:

frontend
acl host_web3 path_beg /jhub
use_backend web3_cluster if host_web3

backend
backend web3_cluster
   mode http
   #http-request set-header Host bk.dom.com
   balance roundrobin # roundrobin is rotate customers into backend server
   server  web1 10.1.100.156:8000/jhub check inter 2000 cookie w1
   server  web2 10.1.100.160:8000/jhub check inter 2000 cookie w1


I am running into a redirect loop , I cant login to the backend UI, i get
this error:

     500 : Internal Server Error

Redirect loop detected.


Not sure why I am getting this error.  the application is jupyterhub , it
runs OK with Apaches reverse proxy .





On Tue, Oct 23, 2018 at 8:35 AM Aleksandar Lazic <al-hapr...@none.at> wrote:

> Hi.
>
> Am 23.10.2018 um 09:04 schrieb Imam Toufique:
> > I am looking for some help on how to write the following apache
> proxypass rules
> > in HAproxy.  Not to mention I am at a bit of loss with my first try :-)
> .  Here
> > are my current proxypass rules:
> >
> > ProxyPass http://10.1.100.156:8000/jhub
> > ProxyPassReverse http://10.1.100.156:8000/jhub
>
> Well ProxyPass and ProxyPassReverse do a lot of thinks not just rewrites,
> as
> mentioned in the doc
>
> https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass
> https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypassreverse
>
>
> > <LocationMatch
> "/jhub/(user/[^/]*)/(api/kernels/[^/]+/channels/websocket)(.*)">
> >     ProxyPassMatch ws://10.1.100.156:8000/jhub/$1/$2$3
> >     ProxyPassReverse ws://10.1.100.156:8000/jhub/$1/$2$3
> > </LocationMatch>
> >
> > As I am not well versed in the massive HAproxy configuration guide, if
> any of
> > you can give me a hand with this, I would very much appreciate it.
>
> I'm also not "that" expert but I would try the following, untested.
>
> ###
> defaults
>   mode http
>   log global
>
>   #... maybe some other settings
>   timeout tunnel 10h
>
> frontend https_001
>
>   #... maybe some other settings
>
>   acl websocket path_beg /jhub
>
>   #... maybe some other  acls
>
>   use_backend websocket_001 if websocket
>
> backend websocket_001
>
>   reqrep "^([^\ :]*)
> /jhub/(user/[^/]*)/(api/kernels/[^/]+/channels/websocket)(.*)"
> "/jhub/\1/\2\3"
>
>   # You will need to replace the first column with the response from the
>   # backend response
>   # rspirep "^Location:
> /jhub/(user/[^/]*)/(api/kernels/[^/]+/channels/websocket)(.*)" "Location:
> /jhub/\1/\2\3"
>   # OR
>   # http-response replace-header Location
> "/jhub/(user/[^/]*)/(api/kernels/[^/]+/channels/websocket)(.*)"
> "/jhub/\1/\2\3"
>
>   # add some checks
>
>   server ws_01 10.1.100.156:8000 check
> ###
>
> Here are some links which may help you also.
>
> https://www.haproxy.com/blog/websockets-load-balancing-with-haproxy/
> https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#4-reqirep
> https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#4-rspirep
>
> I would run haproxy in Debug mode and see how the request pass haproxy and
> adopt
> the config.
>
> It would be nice when you show us the working conf ;-)
>
> It would be nice to have a
>
> http-request replace-uri <match-regex> <replace-fmt>
>
> to replace the reqrep.
>
> > thanks
>
> Hth
> Aleks
>
>

-- 
Regards,
*Imam Toufique*
*213-700-5485*

Reply via email to