Reverse Proxy with Deluge WebUI

A reverse proxy is where there is an existing http web server (Apache, Nginx) that you wish Deluge WebUI to be served through. e.g. Site http://example.net serves the WebUI at http://example.net/deluge.

In the configurations below deluge-web is running on localhost with default port 8112 and reverse proxy url suffix /deluge.

Apache Config:

Enable the following apache modules:

a2enmod proxy
a2enmod proxy_html
a2enmod proxy_http
a2enmod headers

And add the following to your .conf file:

ProxyPass /deluge http://localhost:8112/

<Location /deluge>
    ProxyPassReverse /
    ProxyPassReverseCookiePath / /deluge               
    RequestHeader set X-Deluge-Base "/deluge/"          
    Order allow,deny
    Allow from all
</Location>
Nginx Config:
location /deluge {
    proxy_pass http://localhost:8112/;
    proxy_set_header X-Deluge-Base "/deluge/";
    include proxy-control.conf;
    add_header X-Frame-Options SAMEORIGIN;
}

Note: Ensure the trailing slashes are maintained.

lighttpd Config:

You will need to install lua >= 5.1 and make sure lighttpd >= 1.4.12 is compiled with lua support. Lua will perform URL rewriting since lighty doesn't support it natively.

server.modules += ( "mod_proxy", "mod_magnet", "mod_setenv" )
$HTTP["url"] =~ "^/deluge/" {
    setenv.add-request-header = ( "X-Deluge-Base" => "/deluge/" )
    magnet.attract-raw-url-to = ( "/etc/lighttpd/lua/deluge.lua" )
    proxy.server = ( "" => ( "deluge" => ( "host" => "127.0.0.1", "port" => 8112 ) ) )

/etc/lighttpd/lua/deluge.lua contains:

lighty.env["request.uri"] = string.sub(lighty.env["request.uri"], string.len('/deluge/'))
return
WebUI base Option:

If you cannot configure your server with the RequestHeader, you can either set the base value in the web.conf file or run deluge-web with the --base argument to achieve the same effect:

 deluge-web --base /deluge/
Last modified 16 months ago Last modified on Mar 30, 2018 10:05:34 PM