I did this once. All I needed was a proxy to the host running Duplicati, on the default port (8200).
duplicati.example.com {
proxy / [duplicati-host]:8200
}
Hi Matt
Unfortunately that doesnât work, try it (https://github.com/duplicati)
The main issue i think is that Duplicati still doesnât have the usual built-in setting to add the base url that most other web apps add for reverse proxy users. Why they havenât added it yet, I have no idea, it seems that itâs been requested several times already.
Iâve gotten âpretty closeâ to getting it working, but only got the page itself loaded; all of itâs assets didnât load, so youâd only see a white page with the source on it, and itâs place holder tokens, unrendered. Then I ran out of time to keep fighting with it, and had to move onto other issues needing tackling.
It looks like thereâs some url rewriting necessary, and needing to exclude the â/duplicatiâ from the path in some cases, while keeping it in others ⌠really weird. It also seems like you might need to individually proxy each $%^#^ sub folder for the assets as well, but I never got that working. (see post)
Then again, Iâm a n00b to Caddy still (only been using it for about a week), so perhaps more experienced Caddyâers will know right away how to handle this. crossing fingers lol
So I went and reinstalled Duplicati on a VPS host to test this. I got it working with the following Caddyfile:
duplicati.whitestrake.net {
proxy / localhost:8200
}
The only drawback was that in later updates, Duplicati is very particular about which hostnames youâre allowed to access it from. Until youâve configured it, it only allows localhost. This means that it canât be proxied to by an external host until youâve logged on locally, but you get an error:
The host header sent by the client is not allowed
Since my environment is Docker, I simply configured the Duplicati container with network_mode: service:caddy
so that Caddy could reference it by localhost:8200
, and you can browse to https://duplicati.whitestrake.net to see the result.
[edit: In retrospect, based on the wording of the setting and the error, I suspect that configuring the header_upstream Host localhost
subdirective might get around this, too, but I didnât actually test that.]
If youâre still having problems, post your Caddyfile and weâll see if someone can figure out what might be causing them.
That said, with the way you mention the path /duplicati
and the base URL setting, Iâve got a feeling youâre going to tell me youâre trying to put it in a subfolder. Thatâs not going to be easy at all, and youâll notice that the config I posted originally and the one in this post both donât use a subfolder, they give Duplicati the entire web root of a subdomain instead.
This issue pops up very frequently, and Iâve made a number of posts on the topic, the most recent being here:
The nginx config you posted by way of example would be the stopgap method 3 I mention there.
Aaaaaaa HAAAAA! So thatâs the problem. You nailed it; I have duplicati as a subfolder of the root.
I run both duplicat and Caddy on the same local machine, and set the Caddy server to a sub domain like caddy.mysite.com:1234.
Then try to set all reverse proxies through that. In most cases, the sites that run on their own server + port I can just do the usual proxy /whatever 127.0.0.1:4321, and set the baseurl of /whatever in itâs settings, but duplicati doesnât like that.
I guess Iâll just create another subdomain in the caddyfile just for duplicati, and maybe add that subdomain to my hosts file, or something. Iâm only wanting to use duplicati locally, to backup local machines.
Side note, while researching the issue I had come across another post where someone suggested using the Filter plugin to append the baseurl to all pages, to âforceâ it when the web app itself doesnât already have it built-in; i cant find the original post, but doing a search just now came up with an even better one: https://caddy.community/t/solved-add-a-base-tag-when-reverse-proxying-with-a-subirectory/4682/3
I wonder if this would be just as good? I guess Iâll just have to give it a try.
Anyway, thanks a million for taking the time to install it and figure it out, itâs genuinely appreciated!
Itâs worth a shot.
The only thing that filter wonât do is change Location
headers, which means that while you can fix links in HTML, a login redirect or similar might still be âbrokenâ.
This PR (which has been sitting for a little while, unfortunately) would give proxies the ability to regex rewrite headers as they come back from upstream, which would solve this part of the puzzle:
https://github.com/mholt/caddy/pull/2144
Combined, you could âjailâ any app properly in a subfolder, abstracting all the link differences without needing a base URL.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.