HAProxy community

Haproxy & pyload

Hello,

Discovering the world of haproxy with :

  • HA-Proxy version 1.7.5-2
  • 6 servers on a raspberry:
    • Plex
    • Ocotprint
    • Domoticz
    • PyLoad
    • Transmission

Haproxy is used for ssl termisation. As Plex has his own encryption method, no backend for it.
For the others:
use_backend webcam if { path_beg /webcam/ }
use_backend pyload if { path_beg /pyload/ }
use_backend transmission if { path_beg /transmission/ }
use_backend domoticz if { path_beg /domoticz/ }
default_backend octoprint

backend webcam
reqrep ^([^\ :])\ /webcam/(.) \1\ /\2
server webcam 127.0.0.1:8081

backend pyload
reqrep ^([^\ :])\ /pyload/(.) \1\ /\2
rsprep ^([^\ :])/(.) \1\ /pyload/\2
server pyload 127.0.0.1:8000 check

backend transmission
option forwardfor
server transmission 127.0.0.1:9091

backend domoticz
reqrep ^([^\ :])\ /domoticz/(.) \1\ /\2
server domoticz 127.0.0.1:8080

backend octoprint

reqrep ^([^\ :])\ /(.) \1\ /\2

    option	forwardfor
    server octoprint 127.0.0.1:5000

I have a issue with the backend pyload.
If I click on a button on the main page, for example downloads, my webrowser will get the url https://my.server.org/downloads. In that case the backend default will be used.
I should modify the response to https://my.server.org/pyload/downloads

I think this can be carried out with rsprep, is-it right ? Any other advices ?

In the pyload settings, set the appropriate path prefix and remove the reqrep and rsprep rules.

Haproxy won’t replace links in the http payload (therefor rsprep won’t do anything) and links would keep pointing to the wrong path.

In general, unless you can configure all your applications like you can configure pyload, I strongly suggest to use different hostnames instead of path prefixes, because of those exact issues.

reqrep is for request headers and reprep is for response headers, none of these functions replace the wrong links in the HTML.

I tried adding pyload as path prefix into pyload, same issue. Pyload doesn’t take into account the prefix when clicking a link. Probably an issue with pyload this time.
I will try with different hostnames and let you know.

Many thanks for your support

pyload has been installed through docker with webui accessible under localhost:8000.
It works locally, same issue when I click on a link.

haproxy configuration:
use_backend pyload if { path_beg /pyload/ }

backend pyload
server pyload 127.0.0.1:8000

Like I said above, use hostname instead.