Struggling to get reverse proxy working with Deluge

I currently have Caddy reverse proxying various services of mine without issue. However, I’m struggling to get a reverse proxy working with Deluge. http://deluge-torrent.org/

This is what I currently have in my caddyfile for the deluge reverse proxy:

proxy /deluge http://127.0.0.1:8112 {
    	transparent
    	header_upstream X-Forwarded-Host {host}
    	}

However, it just gives me an error that says “No Such Resource. No such child resource.”

Has anyone been able to get it to work? Here are instructions for reverse proxy with Deluge for Apache and Nginx. But they unfortunately don’t have instructions for Caddy.
http://dev.deluge-torrent.org/wiki/UserGuide/WebUI/ReverseProxy

Did you specify the base path required for Deluge as specified in the user guide you’ve linked to? You can either use a command line argument for Deluge or set a header_upstream for Caddy.

Can you give me an example of what my code would turn into if I used header_upstream? I already have one line using header_upstream - does a second get added?

I’m extremely new to Caddy - would it look like this or something?

proxy /deluge http://127.0.0.1:8112 {
    	transparent
    	header_upstream X-Forwarded-Host {host}
        header_upstream X-Deluge-Base "/deluge/"
    	}

Yep, so adding a line like

header_upstream X-Deluge-Base /deluge/

might help

So I’ve tried both of the following, and neither work. Still giving me “No Such Resource. No such child resource.” Any other thoughts?

proxy /deluge http://127.0.0.1:8112 {
    	transparent
    	header_upstream X-Forwarded-Host {host}
        header_upstream X-Deluge-Base "/deluge/"
    	}

And

proxy /deluge http://127.0.0.1:8112 {
    	transparent
    	header_upstream X-Forwarded-Host {host}
        header_upstream X-Deluge-Base /deluge/
    	}

I’m trying to achieve the same thing and failing, I’m not sure what we are doing wrong.

I still haven’t figured out a working solution yet. Does anyone else have any ideas? I’ve posted in both the Deluge forum and their IRC, and haven’t gotten any responses yet from either.

With help on reddit, I was able to get Deluge working 90% of the way using the following. It seems like some of the icons in Deluge are wonky, but this is as close as I could get.

rewrite {
    if {>Referer} has /deluge
    to /deluge/{path}
}

proxy /deluge http://127.0.0.1:8112 {
        without /deluge	
		transparent
    	header_upstream X-Forwarded-Host {host}
}

Does anyone know what could be changed/added to allow Deluge to fully display properly?

1 Like

What do you mean by wonky ? Is it a 404 ?

No, not a 404. It successfully connects in, and I can interact with it. However, some of the webpage elements didn’t load fully. For instance, the the webUI password box that appears is missing it’s outline and background. I can still type in my password and get in, but in some of the menus the lack of loading makes it a little bit tough.

If I inspect the page in chrome, I’m seeing the following errors: https://img2.picload.org/image/rrpggdal/deluge_web_ui_1.3.13.png

Those are 404s though. That means the basic configuration seems correct but the assets (maybe only images) are missed out.

Can you access the deluge instance directly and get the path to the images. Then we can compare with the request path from Caddy to find any possible mismatch.

I think I’ve got it solved (with much help over on reddit). Below is the code I have that got it to work. This is inside my mydomain.com:443 code block.

rewrite {
	if_op or
	if {>Referer} has /deluge
	if {>Referer} has mydomain.com/themes/css/
	if {>Referer} has mydomain.com/css/
	to /deluge/{path}
}

proxy /deluge http://127.0.0.1:8112 {
    without /deluge	
	transparent
	header_upstream X-Forwarded-Host {host}
}

Just change ‘mydomain.com’ to your actual domain name. No more 404 errors on the page, and all assets load! For a version that works within a localhost:80 code block, you can use this:

rewrite {
	if_op or
	if {>Referer} has /deluge
	if {>Referer} has /localhost/themes/css/
	if {>Referer} has /localhost/css/
	to /deluge/{path}
}

proxy /deluge http://127.0.0.1:8112 {
    without /deluge	
	transparent
	header_upstream X-Forwarded-Host {host}
}

Hope this helps others!

FYI I have a working Deluge setup that is a bit simpler, this is running on Caddy 0.9.3:
proxy /deluge http://deluge:8112/ { transparent without /deluge header_upstream X-Deluge-Base "/deluge" }

2 Likes

Wow, that is much simpler. Thanks for the info!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.