Hi,
after a whole day of testing, configuring and countless changes to my Caddyfile I still cannot figure out how to use Caddy as a reverse proxy running on HA and forwarding requests from one URL based on the subdirectory to different targets.
When only using the base URL of my DDNS Service I can get some services to work, but the idea is to use subdirectories to forward to different services in my local network.
Currently my Caddyfile for the domain looks like this:
myurl.tld.de {
route /qnap* { # QNAP NAS
uri strip_prefix /qnap
reverse_proxy /qnap* 10.0.0.1:8088
}
route /unifi* { # QNAP Unifi Controller
uri strip_prefix /unifi
reverse_proxy {
to 10.0.0.1:38193
transport http {
tls_insecure_skip_verify
}
}
}
route /homeassistant* { # Home Assistant
uri strip_prefix /homeassistant
reverse_proxy 10.0.0.2:8123
}
route /grocy* { # HA Grocy
uri strip_prefix /grocy
reverse_proxy 10.0.0.2:8080
}
route /barcodebuddy* { # HA Barcode Buddy for Grocy
uri strip_prefix /barcodebuddy
reverse_proxy 10.0.0.2:8621
}
}
No matter what I do, I cannot get to any of the services using the URL, eg. http://myurl.tld.de/qnap
I was able to use just one service, by just forwarding it to the domain only without any subdirectory to it. At least for my QNAP service, when replacing it with the HA address it did not work, but it seems to be impossible to do this for multiple services.
I choose Caddy since it takes care of SSL, etc and since it was claimed to have a rather simple configuration. However whatever I do, I cannot get it to work. Most times all I get is a white screen and the URL gets some redirect.html?count=0.6972589800114705
added to it.
Does anyone know what I am doing wrong here? I would have loved to use Caddy for securely connecting services directly over the internet and handling the internal routing through it.
I’m totally lost here. I checked different approaches (also checking handle_path
to replace route
and uri strip_prefix
) and whatever I could think of, but the result was mostly the same. In all cases it did not work.
So maybe somebody here knows what I am missing here?
Thanks a lot!