簡體   English   中英

Url 在IIS 中改寫為不同域調用基於url 的多個服務

[英]Url rewrite in IIS for different domain to call multiple service based on url

我有多個服務在域 abc.com 上的服務器上運行,我的 web 應用程序在不同的服務器 xyz.com 上運行。 我有一個要求,其中我需要以這樣的方式編寫 urlrewrite,如果我鍵入

  • xyz.com/service1 -> 如果我輸入,它應該以同樣的方式調用在 abc.com:1234 上運行的 service1
  • xyz.com/service2 -> 它應該調用/重定向到運行在 abc.com:5678 上的 service2 等等。

url 怎么改寫呢?

我正在使用 IIS 版本 10 window 服務器 2022

您可以嘗試使用反向代理,以下案例可以作為參考:

<rewrite>
  <rules>
    <rule name="Reverse Proxy to service1" stopProcessing="true">
        <match url="(.*)" />
          <conditions>
            <add input="{SERVER_PORT}" pattern="1234" />
          </conditions>
        <action type="Rewrite" url="http://x.com/service1" />
    </rule>
    <rule name="Reverse Proxy to service2" stopProcessing="true">
        <match url="(.*)" />
          <conditions>
            <add input="{SERVER_PORT}" pattern="5678" />
          </conditions>
        <action type="Rewrite" url="http://x.com/service2" />
    </rule>
  </rules>
</rewrite>

更多信息您可以參考此鏈接: Reverse Proxy with URL Rewrite v2 and Application Request Routing

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM