Reverse Proxy on NGINX

Hi everyone,

I have successfully installed duplicati under docker, up and running, so far so good.

Now I try to put it behind Nginx and use proxy_pass. But not that successful.

In short, I try to do a proxy_pass to http://xxx/duplicati/. After I login, it redirects to http://xxxx instead of http://xxx/duplicati/agax/index.html. Is that something I can do on the nginx side, or duplicati is using rewrite which I could not fix without going into its source code ?

To avoid any doubt, duplicati is running perfectly even behind nginx, I just need to type the correct URL http://xxx/duplicati/agax/index.html after login. The only issue is the apparent rewrite / redirection after logging in.

Thanks.

Regaards
Alex

Hi @alexkwan, welcome to the forum!

While I’m not personally familiar with proxy_pass I’m curious if you’ve used it for anything else - particularly with a Docker container…

It is my practise to encapsulate every single application with web interface using nginx . I have a login system and SSL Cert on the nginx server so that all application behind nginx have extra layer of security and also a single SSL Cert.

To avoid messing up the system environment of the applications (like some appplications requires different version of JRE and MONO), I choose docker. Another advantage in using docker is that when I need to upgrade one of the applications, I just need to create another testing container. Further, by taking the advantage of snapshot features of file systems (or VMs), the whole docker environment could be snapshot-ed, this is super-convenient when migrating to a new hardware (or new pool in VM cases).

To answer your question directly: No. no other use, just to backup ^^.

Personally I’m just getting started with Docker and I like what I’ve seen so far, but your methods sound like a great standard to strive for. :slight_smile:

I asked about the Docker side of things because I know with my (limited) experience it can be easy to got confused as to what ports / paths are being exposed to the container, but it doesn’t sound like that’s likely the issue here.

Hopefully somebody more familiar with the GUI side of things (maybe @davegold or @kenkendk) will have more insight into your reverse proxy / nginx use.

When I need to use nginx or apache as a reverse proxy, instead of pointing to noodles, I use a subdomain, in my tests, it has worked better.

server {
listen 80;
server_name duplicati.domain.com;

location / {
    proxy_pass http://127.0.0.1:8200;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

}

1 Like

If you want to use a sub-path, you can use the nginx configuration I have for Synology:

It does the same as @tacioandrade’s version, but rewrites just a path, instead of using a subdomain.

1 Like

I can confirm that Duplicati works fine behind an Apache proxy. Here’s my configuration if it’s of any use:

<VirtualHost *:80>
    ServerName my.personal.subdomain
    # Password protection
     <Location />
        AuthType Basic
        AuthName "Authentication required"
        AuthBasicProvider file
        AuthUserFile /etc/apache2/passwords
        Require user myuser
    </Location>
    AllowEncodedSlashes On
    ProxyPass           / http://localhost:8200/ disablereuse=on
    ProxyPassReverse    / http://localhost:8200/
</VirtualHost>
2 Likes