Files
skytek_xinliang 32a99350e2 chore: iis setting
2026-08-06 15:15:05 +08:00

41 lines
1.8 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!--
部署到 IIS 用。Vite build 會把 public/ 底下的檔案原封不動複製到 dist/ 根目錄,
所以這份檔案最終會出現在 IIS 網站的實體路徑根目錄。
這個網站與後端 API(/service)掛在同一個站台/port 下,前端只處理自己的
SPA routing/service 開頭的請求一律不改寫,直接放行給後端的應用程式。
-->
<configuration>
<system.webServer>
<staticContent>
<!-- 部分 IIS 版本預設沒有註冊字型 MIME type,MDI 圖示字型會 404 -->
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="font/woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
</staticContent>
<rewrite>
<rules>
<!--
Vue Router 用 history 模式(無 # 號),使用者直接刷新 /course 這類子路徑時,
IIS 預設會找不到實體檔案而回 404。這條規則把「非實體檔案/目錄、且不是
/service 開頭」的請求都導回 index.html,交給前端路由自己處理。
-->
<rule name="SPA fallback to index.html" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{PATH_INFO}" pattern="^/service" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>