Lighttpd and HAProxy?

I would like to install lighttpd onto a current instance of octopi so that I can serve other webpages and potentially run some webhooks through php.

My problem is that I do not know enough about how to configure lighttpd and haproxy, I tired to install lighttpd and make changes to haproxy config but lighttpd seemed to completely bypass haproxy and I could not access octoprint or any other backends. Definitely seemed like lighttpd was acting on its own, not behind haproxy.

I played with haproxy and lighttpd config a little but I'm certainly no expert so couldn't get it to work.

I was wondering if anyone else has successfully got this set up running or could point me in the direction of a guide if one exists (I searched to no avail).

Thanks in advance


So, I'm guessing that you'd be using haproxy for its ability to proxy rather than as a load balancer. I assume that you're trying to reach your printer on a private network from the Internet. Unfortunately, I'm not seeing any dual lighttpd + haproxy tutorials or examples out there on the Internet.

I personally wrote my own proxy using Node.js and then used port forwarding from my firewall to route a high port to that server (which runs on a Raspberry Pi Zero W computer). By separating this onto another (cheap) computer, this felt like a cleaner install to me. I think I would recommend this separation tactic for you as well.

If you introduced another cheap computer into the mix you could hack away at it without worrying about polluting your OctoPrint install. Remote GPIO allows you to remotely do some fun stuff between the two computers as well as using remote ssh to run scripts on the other computer and do things with the response.

In my case, the proxy makes API calls to OctoPrint to get the information and then returns it back out to the Internet. Usually, this is all you need to know, I'd guess.

But if you did need more knowledge about the first computer, you could run those remote commands via ssh locally and proxy them back to the Internet, if that's what you're trying to do.

lighttpd: Did you see this section for the lighttpd.conf file? It probably needs to point to that haproxy instance.

#### proxy module
## read proxy.txt for more info
#proxy.server               = ( ".php" =>
#                               ( "localhost" =>
#                                 (
#                                   "host" => "",
#                                   "port" => 80
#                                 )
#                               )
#                             )

Thanks, I'll look into remote control like you suggested