qBittorrent Subdirectory

1. Output of caddy version:


2. How I run Caddy:

docker container with docker compose, completely new as of 8 hours ago, i’m running jellyfin through caddy perfectly fine it seems so I think it’s definitely the caddyfile

a. System environment:

Ubuntu Server w/ Docker 20.10.18

b. Command:

sudo docker compose up -d

c. Service/unit/compose file:


    image: caddy
    container_name: caddy
    hostname: caddy
    restart: unless-stopped
      - "80:80"
      - "443:443"
      - "8096:8096"
      - ruanf.ddns.net
      - ./Caddyfile:/etc/caddy/Caddyfile
      - ./data:/data
      - ./config:/config

    name: caddy_net
    external: true

d. My complete Caddy config:

    # acme_ca https://acme-staging-v02.api.letsencrypt.org/directory

ruanf.ddns.net {
    redir                 /jellyfin                 /jellyfin/
    reverse_proxy /jellyfin/*   
    redir                 /qbt                      /qbt/
    reverse_proxy /qbt/          
        header_up Host
        header_up  X-Forwarded-Host {hostport}
        header_up -Origin
        header_up -Referer

3. The problem I’m having:

I’m trying to access qbittorrent through a subdirectory since i’m using a ddns domain. I can’t access the website with the error Not Found or a blank page.

4. Error messages and/or full log output:

{"level":"error","ts":1664749020.9666078,"logger":"http.log.error","msg":"dial tcp: lookup Host on server misbehaving","request":{"remote_ip":"","remote_port":"13160","proto":"HTTP/2.0","method":"GET","host":"ruanf.ddns.net","uri":"/qbt/","headers":{"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Cache-Control":["no-cache"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate, br"],"Dnt":["1"],"Upgrade-Insecure-Requests":["1"],"Te":["trailers"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0"],"Accept-Language":["en-US,en;q=0.5"],"Sec-Fetch-Site":["cross-site"],"Pragma":["no-cache"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"ruanf.ddns.net"}},"duration":0.003140927,"status":502,"err_id":"7ry5irxkm","err_trace":"reverseproxy.statusError (reverseproxy.go:1271)"}

5. What I already tried:

I’ve looked at these threads but the config doesn’t really help, since some are from V1, or others I literally am using the config from but with worse results.

qBittorrent and Caddy reverse proxy - Help - Caddy Community

Qbittorrent WEBUI and caddy v2 - Help - Caddy Community

qBittorrent Web UI – Reverse Proxy Help - Help - Caddy Community

Side note: is there a reason I can’t use container names and their ports instead of the local ip as it seems as if it’d make it slightly more resistant even though I do have the ip for the server reserved?

6. Links to relevant resources:

in answer above

I haven’t touched WebUI settings as there isn’t much documentation on what settings to change.

You’re using some pretty strange syntax there. Also you need to use a * for the qbt proxy matcher. I also don’t think you need any of the header_up lines. Try this instead:

ruanf.ddns.net {
    redir /jellyfin /jellyfin/
    reverse_proxy /jellyfin/*

    redir /qbt /qbt/
    reverse_proxy /qbt/*

Are all your containers in the same Docker network? That should work just fine. Make sure the other containers are not using host networking.


They’re all in caddy_net, the external directory managed by caddy or at least I think it is.

Would this work without the GitHub - lucaslorentz/caddy-docker-proxy: Caddy as a reverse proxy for Docker module?

I’m not sure I understand the question. I don’t see you using CDP in your original post. So I’m not sure what you mean by “this”.

Yes, obviously you can use Caddy as a proxy without CDP (or even without Docker). The point of CDP is to auto-configure Caddy based on Docker labels. If you’re writing your own Caddyfile and are happy doing that, you don’t need CDP.

I meant does using container hostnames to route traffic without CDP work? It currently isn’t so that’s why I’m wondering what I’m doing wrong.

Yes, absolutely. That’s a Docker thing. Docker has a built-in DNS resolver that maps container names to container IPs in their network.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.