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 serves the WebUI at

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
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" => "", "port" => 8112 ) ) )

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

lighty.env["request.uri"] = string.sub(lighty.env["request.uri"], string.len('/deluge/'))
HAProxy Config:
frontend https
        bind *:443 ssl crt /etc/haproxy/certs/<YOUR-PEM-HERE>
        compression algo gzip
        default_backend <DEFAULT-BACKEND-HERE>
        use_backend Deluge if { path_beg /deluge }

backend Deluge
        server deluge localhost:8112
        reqrep ^([^\ ]*\ /)deluge[/]?(.*)     \1\2
        http-request add-header X-Deluge-Base /deluge
        http-request add-header X-Frame-Options SAMEORIGIN
IIS Config:

Assuming IIS is already setup for reverse proxying (plenty of tutorials on this online). Under site -> URL Rewrite, click on View Server Variables... and add a new variable name HTTP_X_Deluge_Base. Then open your web.config file and add/edit your rule as follow (edit url to match your setup):

<rule name="Deluge" stopProcessing="true">
    <match url="deluge\/?(.*)" />
    <action type="Rewrite" url="{R:1}" />
        <set name="HTTP_X_Deluge_Base" value="/deluge/" />
Last modified 3 years ago Last modified on 09/04/2020 07:19:09 PM