简体   繁体   English

IIS反向代理和URL重写以将URL重写到另一个内部Web服务器中的另一个文件夹

[英]IIS Reverse-proxy and URL-Rewrite to rewrite URL to another folder in another internal webserver

Please, give me some advices how to implement the following by creating a URL-Rewrite rules. 请给我一些有关如何通过创建URL重写规则来实现以下建议的建议。 On the same machine I have: 在同一台计算机上,我有:

 1. IIS with "mysite.ddns.net/xxxxxx/" accessible via internet
 2. uTorrent with WebUI "192.168.0.5:8080/gui/" which is accessible only via LAN.

I made following rules: 我制定了以下规则:

<rule name="root to xxxxxx" enabled="true" stopProcessing="true">
    <match url="^$" />
    <action type="Redirect" url="/xxxxxx/" />
</rule>

<rule name="http to https" enabled="true" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
        <add input="{HTTPS}" pattern="^OFF$" />
    </conditions>
    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>

<rule name="ReverseProxy_uTorrent_Inbound" enabled="true" stopProcessing="true">
    <match url="^utorrent/(.*)" />
    <action type="Rewrite" url="http://192.168.0.5:8080/{R:1}" logRewrittenUrl="false" />
    <serverVariables>
        <set name="HTTP_ACCEPT_ENCODING" value="" />
    </serverVariables> 
</rule>

So, to access to uTorrent I need to type "mysite.ddns.net/utorrent/gui/" But it would be more comfortable to me to enter "mysite.ddns.net/utorrent/" . 因此,要访问uTorrent,我需要输入"mysite.ddns.net/utorrent/gui/"但输入"mysite.ddns.net/utorrent/"对我来说会更舒服。 I tried to replace the above rule with the following: 我尝试将以下规则替换为:

<rule name="ReverseProxy_uTorrent_Inbound_2" enabled="true" stopProcessing="true">
    <match url="^utorrent/" />
    <action type="Rewrite" url="http://192.168.0.5:8080/gui/" appendQueryString="true" logRewrittenUrl="true" />
    <serverVariables>
        <set name="HTTP_ACCEPT_ENCODING" value="" />
    </serverVariables> 
</rule>

but received very strange answer from the uTorrent 但收到了来自uTorrent的非常奇怪的答复

"Loading...
About
uTorrent µTorrent WebUI
Developers:..."

and so on. 等等。

I already searched a lot, but unfortunately, I have not found a solution yet. 我已经搜索了很多,但不幸的是,我还没有找到解决方案。 Do you have any idea? 你有什么主意吗?

I didn't test it, but should work: 我没有测试它,但是应该可以工作:

<rule name="ReverseProxy_uTorrent_Inbound" enabled="true" stopProcessing="true">
    <match url="^utorrent/(.*)" />
    <action type="Rewrite" url="http://192.168.0.5:8080/gui/{R:1}" logRewrittenUrl="false" />
    <serverVariables>
        <set name="HTTP_ACCEPT_ENCODING" value="" />
    </serverVariables> 
 </rule>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM