Traefik and Deluge returns No such Resource

857 Views Asked by At

I just started to use Traefik and trying to connect Deluge(torrent) docker container to traefik which is also running in container. The problem is when I'm trying to reach deluge web ui through somename.ddns.net/deluge I get error 404 No Such Resource. No such child resource. So far I can only reach it directly by localip:8113/deluge OR if I setup traefik router to be in root path like somename.ddns.net/ but I want to setup it to /deluge. Below my current configuration. I saw some nginx users had similar issue, but they solved somehow, so should be a way to fix in traefik.

traefik docker-compose.yml

version: "3"
services:
  traefik:
    networks:
      - traefik
    image: traefik
    container_name: traefik
    restart: unless-stopped
    ports:
      - 8085:80
      - 8086:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./data:/my_data
    environment:
      - TRAEFIK_API=true
      - TRAEFIK_PROVIDERS_DOCKER=true
      - TRAEFIK_PROVIDERS_DOCKER_EXPOSEDBYDEFAULT=false
      - TRAEFIK_ENTRYPOINTS_HTTP_ADDRESS=:80
      - TRAEFIK_LOG=true
      - TRAEFIK_LOG_LEVEL=DEBUG
      - TRAEFIK_LOG_FILEPATH=/my_data/error.log
      - TRAEFIK_ACCESSLOG=true
      - TRAEFIK_ACCESSLOG_FILEPATH=/my_data/access.log
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik-http.rule=Host(`somename.ddns.net`)"
      - "traefik.http.routers.traefik-http.service=api@internal"
      - "traefik.http.routers.traefik-http.entrypoints=http"
networks:
  traefik:
    external: true

deluge docker-compose.ym

version: "3"
networks:
  traefik:
    external: true
services:
  deluge:
    image: linuxserver/deluge
    container_name: new_deluge
    restart: unless-stopped
    ports:
      - 8113:8112
    environment:
      - PUID=1000
      - PGID=1000
      - DELUGE-LOGLEVEL=error
    volumes:
      - /home/ubuntu/.config/new_deluge:/config
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.deluge.rule=Host(`somename.ddns.net`) && Path(`/deluge`)"
      - "traefik.http.routers.deluge.middlewares=deluge-headers"
      - "traefik.http.middlewares.deluge-headers.headers.customrequestheaders.X-Deluge-Base=/deluge"
      - "traefik.http.middlewares.deluge-headers.headers.customrequestheaders.X-Frame-Options=SAMEORIGIN"
      - "traefik.docker.network=traefik"
    networks:
      - default
      - traefik

Thank you in advance

1

There are 1 best solutions below

0
On

so I eventually found how to make it work with subdirectory, though it's a bit tricky, I'll explain below why. My labels in deluge docker-compose looks so now:

"traefik.enable=true"                                                                                                                                                    
"traefik.http.routers.deluge.rule=Host(`somehost.com`) && Path(`/deluge`) || PathPrefix(`/deluge`)"                                                                 
"traefik.http.services.deluge.loadbalancer.server.port=8112"                                                                                                             
"traefik.http.routers.deluge.entrypoints=https,http"                                                                                                                     
"traefik.http.routers.deluge.middlewares=deluge-stripprefix"                                                                                                             
"traefik.http.middlewares.deluge-stripprefix.stripprefix.prefixes=/deluge"                                                                                               
"traefik.http.routers.deluge.tls=true"                                                                                                                                   
"traefik.docker.network=traefik"          

Also you need to update base key in web.conf to be your desired subdir base: "/deluge" After that you'get your deluge UI be accessibale on https://somehost.com/deluge, BUT you can't use it locally (e.g. 192.168.1.25) as all .css/.js files now will be requested to 192.168.1.25/deluge/style.css which is incorrect. What traefik does here is on all somehost.com/deluge request just strip /deluge part and transfer request to 192.168.1.25 path, without subdir. For me it's fine, I'm using SSL to secure requests so it's ok to use outside of my network same with using it at home.

But if you have idea how to make both (global, local) urls work at the same time, I'd very appreciate if you put your answer here.