IIS Reverse Proxy for Deluge WebUI (ajax fail)

Specific support for Deluge on Microsoft Windows OS
electromuis

IIS Reverse Proxy for Deluge WebUI (ajax fail)

Postby electromuis » Thu May 22, 2014 7:56 am

I am trying to redirect the webui of deluge on port 8112 to a folder in my iis server. So that i can access my local server on the other port through an iis subfolder.

http://websitename.com/back/ --> http://192.168.2.14:8112/

I made a folder on the server called back and configures my url rewriting for that. The web.config is in the back folder so I can use a wildcard to redirect data.

Code: Select all

    <rewrite>
        <rules>
          <rule name="CrmInbound" enabled="true">
              <match url="(.*)" />
              <action type="Rewrite" url="http://192.168.2.14:8112/{R:1}" />
          </rule>
      </rules>
      <outboundRules>
          <rule name="CrmOutbound" preCondition="OnlyHtml" enabled="true">
              <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="/(.*)" />
              <action type="Rewrite" value="http://websitename.com/back/{R:0}" />
          </rule>
          <preConditions>
              <preCondition name="OnlyHtml">
                  <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
              </preCondition>
          </preConditions>
      </outboundRules>
    </rewrite>


The site comes throug and loads, it just cant connect and misses some files becuase the reverse proxy wont change the ajax requests.

Here is a screenshot:Image

Any ideas on how to fix this? I tried php reverse proxies and wsgi but cant get it to work.

marianob85

Re: IIS Reverse Proxy for Deluge WebUI (ajax fail)

Postby marianob85 » Thu Nov 19, 2015 8:07 pm

Did You find a solution for IIS ? I've also trying connect deluge to IIS but with no luck. Site is loading, but there is no login window.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
              <outboundRules>
                 <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
                <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/(.*)" />
                     <action type="Rewrite" value="/torrent/{R:1}" />
                 </rule>
                 <preConditions>
                     <preCondition name="ResponseIsHtml1">
                         <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                     </preCondition>
                 </preConditions>
             </outboundRules>
                 
         <rules>
             <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://localhost:81/{R:1}" appendQueryString="true" />
               <serverVariables>
                        <set name="HTTP_ACCEPT_ENCODING" value="" />
                    </serverVariables> 
                 </rule>
             </rules>
         </rewrite>
    </system.webServer>
</configuration>


charliebee
New User
New User
Posts: 1
Joined: Thu Jul 09, 2020 4:46 pm

Re: IIS Reverse Proxy for Deluge WebUI (ajax fail)

Postby charliebee » Thu Jul 09, 2020 5:02 pm

Sorry to revive this 5 year old thread but it's still one of the first Google result and since I figured it out, might as well share the solution here:

Basically, the answer lies in the completely mad way to set request headers in IIS!

First, in URL Rewrite under you reverse proxy site, click on View Server Variables... and add a new variable named HTTP_X_Deluge_Base.

Image


Then, edit your rewrite rule and add a Server Variable with the same name and a value of /deluge/.

Image


Here's a copy of my web.config for reference:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Deluge" stopProcessing="true">
                    <match url="deluge\/?(.*)" />
                    <action type="Rewrite" url="http://1.1.1.1:8112/{R:1}" />
                    <serverVariables>
                        <set name="HTTP_X_Deluge_Base" value="/deluge/" />
                    </serverVariables>
                </rule>               
            </rules>
        </rewrite>
        <caching enabled="false" enableKernelCache="false" />
        <httpErrors errorMode="DetailedLocalOnly" />
    </system.webServer>
</configuration>


Return to “Windows OS”

Who is online

Users browsing this forum: No registered users and 4 guests