Reverse Proxy with Caddy Server

General support for problems installing or using Deluge
Post Reply
Magic815
Member
Member
Posts: 10
Joined: Wed Oct 14, 2015 12:26 pm

Reverse Proxy with Caddy Server

Post by Magic815 »

I'm trying to get reverse proxy working for Deluge using Caddy. I've gotten it set up to successfully reverse proxy all of my services, except Deluge.

Here is info on Caddy: https://caddyserver.com/docs

And this is the best I was able to put into the Caddyfile:

Code: Select all

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}
}
The above code allows for Deluge to work 90% of the way. Some of the webUI details/icons don't load properly, but it at least connects.

Would anyone be able to help me figure out how to get the above code fixed up so that it works 100%? And if a solution is found, could it be added to the Deluge reverse proxy wiki entry?
Magic815
Member
Member
Posts: 10
Joined: Wed Oct 14, 2015 12:26 pm

Re: Reverse Proxy with Caddy Server

Post by Magic815 »

I believe I've found a solution (with a lot of help from a user over on reddit). The following code works inside any server (virtual host) block the user has set up:

Code: Select all

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}
}
* Note: You must change 'mydomain.com' to your actual domain name.


If you want something that works inside a localhost:80 code block, the following is what you need:

Code: Select all

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}
}
Cas - Could the above be added to the reverse proxy Wiki entry? Thanks!
Post Reply