簡體   English   中英

IIS反向代理和URL重寫以將URL重寫到另一個內部Web服務器中的另一個文件夾

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

請給我一些有關如何通過創建URL重寫規則來實現以下建議的建議。 在同一台計算機上,我有:

 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.

我制定了以下規則:

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

因此,要訪問uTorrent,我需要輸入"mysite.ddns.net/utorrent/gui/"但輸入"mysite.ddns.net/utorrent/"對我來說會更舒服。 我嘗試將以下規則替換為:

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

但收到了來自uTorrent的非常奇怪的答復

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

等等。

我已經搜索了很多,但不幸的是,我還沒有找到解決方案。 你有什么主意嗎?

我沒有測試它,但是應該可以工作:

<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