[實作筆記] 使用 IIS 作為 Reverse Proxy Server

情境

  1. 作業系統為 Windows 10
  2. IIS 的版本為 10.0.18362.1
  3. 前端使用 nodejs 開發了一個網站,會在 localhost:3000 執行,提供 UI
  4. 使用 dotnet core 開發了一個網站,在 IIS 上執行,用來提供 Api
  5. 透過鎖 Host 的方式 dotnet core 的網站綁定在 http://dev.api.test

目標

  1. 即使只有開發階段,我也不想看到 localhost:3000 作為我的網址
  2. 我想看到 http://dev.site.test 作為我的站台

本文

首先,鎖 Host 127.0.0.1 dev.site.test
Host 的檔案路徑為 C:\Windows\System32\drivers\etc

接下來請下載並安裝 URL RewriteApplication Request Routing

IIS 建立網站,繫結我設定為 dev.site.test:80
應用程式集區我沒有特別處。
到 IIS 選取站台的 Url Rewrite 新增規則
到 IIS 選取站台的 Url Rewrite 新增規則
選取 Reverse Proxy 規則

選取 Reverse Proxy 規則

填寫 localhost:3000

填寫 `localhost:3000`

這個時候前往 dev.site.test 就可以看到站台囉。

參考

(fin)

Please enable JavaScript to view the Gitalk. :D
Please enable JavaScript to view the LikeCoin. :P
Please enable JavaScript to view the LikeCoin. :P