Version 11 (modified by Crypticus, 5 years ago) (diff)

--

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
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
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/