Replies: 5 comments
-
Discussions around this topic came up a lot and you already mentioned the major problem:
Each application would need an individual webserver config for each of the 3 webservers we offer. Lighttpd is probably the most difficult one, as it, in our experience, requires significantly more tinkering and directives compared to Nginx and Apache. It seems to not forward/set headers a way that is commonly needed. And yes: Every new web application would again need to additional proxy config for each webserver and any new webserver we want to add would require an additional proxy config for each web application. I am already aiming to implement Caddy for some years, and what makes it such a hard undertaking is only the essential webserver configurations for those web applications which do use the webservers (i.e. no the ones which listen on their own ports). If now there comes a proxy config for each standalone web application on top, the tast becomes impossible without a significant team systematically working on it, i.e. a paid project task would be the only thing I could see this done. The idea we had so far to approach this topic:
When the docs have been extended by this and it has been tested/proved for a while by some users, we can start adding it as option (definitely not mandatory!) to individual web application installs in |
Beta Was this translation helpful? Give feedback.
-
At your comment, I've switched lighttpd to nginx and can definitely vouch that the configuration is significantly easier and "just works", so thanks!
Ah yep, this was a thought at the back of my mind I didn't quite voice. Maybe it would be good if DietPi could become super opinionated about the web server it uses to simplify the task? Or barring that, allow for complete webstack freedom of choice (as it is now), but use a dedicated Caddy process purely for binding baseURLs to subdomains. The setup with Caddy looks really nice:
We could then simply add a line for each service in Dietpi! Caddy seems like a really elegant solution to this.
I'm a bit lost here, surely we just need to add a single line to the Caddy config for each webserver?
Yeah, a proxying guide in the official docs would be great! The forums are a great resource, but I had to dig quite a bit to find a solution that worked for me |
Beta Was this translation helpful? Give feedback.
-
Related and super helpful guide: |
Beta Was this translation helpful? Give feedback.
-
Not sure what you mean with "super opinionated"? You mean offering a single webserver/proxy software only for this feature? Indeed that would make it easier, or at least is a good start and can be extended if someone finds the time to implement more. Generally I think this is something to better break down into smaller doable tasks; one backend after another, in case one webserver/proxy software after another.
Before thinking about using Caddy as proxy, we need to implement Caddy in general 🙂. Caddy is not significantly easier or harder in average to setup as proxy, compared to Apache or Nginx. All of them allow to setup a reverse proxy with a single config line, as long as the backend software natively supports it. A more pure proxy choice would be btw HAProxy or frp, which we have both implemented already. All of them allow to proxy via subdomain and sub path, the problem really is the individual needs of the backend and whether it supports base paths or not, as explained in the guide you linked. Sub domains are indeed a good and common option to eliminate most difficulties, but it requires related DNS entries and HTTPS certificates, so is not feasible in all cases. |
Beta Was this translation helpful? Give feedback.
-
Yeah a single proxy-to-backend service, and an optional guide for how to get server-to-proxy working. But after getting deeper into the topic and reading your comments, I can see a bit more clearly that some services might need their headers rewritten, others let you set the baseurls, and I'm sure many other complicated parameters particular to each service.
N=1: I'm finding Caddy generally much easier to configure than either nginx or lighttpd/apache, as it sets a lot of the needed parameters automatically.
Ah okay. These I need to explore more deeply if they're good viable options. My current plan was to use caddy as server-to-proxy and caddy as proxy-to-backend, and I've got a nice simpl(ish) solution running for some apps, but not all. |
Beta Was this translation helpful? Give feedback.
-
Motivation
I currently have the following 4 web services:
To access each of these, I have to type in
http://<my.local.ip>:<port>
(e.g.http://local.home:5961
) for me to access these services.It would be easier if I could simply type in
http://<my.local.ip>/<service>
(e.g.http://local.home/homeassistant
).Further, if I expose my Dietpi device via a reverse proxy, I would only need to forward a single port, with the baseURL → port mappings happening on the Dietpi device instead of the reverse proxy device.
Implementation
This can be done in lighttpd with a custom rule:
but... it doesn't quite work, and I see other complicated rules in the same directory.
I'm sadly not versed enough to debug this problem properly, but I think it could be a major win for this platform if if such services were structured like this already.
Caveats
I do realise that each application would need configuring to be compatible with this setup, and that it would be a large undertaking for anyone submitting a new web service software to the software list.
2 votes ·
Beta Was this translation helpful? Give feedback.
All reactions