78 lines
3.1 KiB
XML
78 lines
3.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!--
|
|
web.config cho React SPA (fe0 / fe-admin)
|
|
Đặt ở: C:\inetpub\DYD.User\web.config và C:\inetpub\DYD.Admin\web.config
|
|
|
|
Mục đích:
|
|
- URL Rewrite: React Router HTML5 history API → fallback /index.html
|
|
- Cache static assets 1 năm (hash filename đảm bảo bust cache khi build mới)
|
|
- Security headers
|
|
- MIME types cho font/webmanifest
|
|
|
|
Deploy: Robocopy /XF web.config để không bị overwrite.
|
|
-->
|
|
<configuration>
|
|
<system.webServer>
|
|
<!-- React Router rewrite -->
|
|
<rewrite>
|
|
<rules>
|
|
<rule name="React Router SPA" stopProcessing="true">
|
|
<match url=".*" />
|
|
<conditions logicalGrouping="MatchAll">
|
|
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
|
|
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
|
|
<!-- Không rewrite /api/* (nếu có reverse proxy) -->
|
|
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
|
|
</conditions>
|
|
<action type="Rewrite" url="/index.html" />
|
|
</rule>
|
|
</rules>
|
|
</rewrite>
|
|
|
|
<!-- MIME types -->
|
|
<staticContent>
|
|
<remove fileExtension=".webmanifest" />
|
|
<mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
|
|
<remove fileExtension=".woff2" />
|
|
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
|
|
<!-- Cache static 1 năm (Vite build hash filename bust cache tự động) -->
|
|
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
|
|
</staticContent>
|
|
|
|
<!-- Security headers -->
|
|
<httpProtocol>
|
|
<customHeaders>
|
|
<add name="X-Content-Type-Options" value="nosniff" />
|
|
<add name="X-Frame-Options" value="DENY" />
|
|
<add name="Referrer-Policy" value="strict-origin-when-cross-origin" />
|
|
<add name="Permissions-Policy" value="geolocation=(), microphone=(), camera=()" />
|
|
<!-- CSP strict (điều chỉnh nếu cần CDN): -->
|
|
<!-- <add name="Content-Security-Policy" value="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' https://api.ski-ump.com.vn" /> -->
|
|
</customHeaders>
|
|
</httpProtocol>
|
|
|
|
<!-- Gzip compression -->
|
|
<httpCompression>
|
|
<dynamicTypes>
|
|
<add mimeType="text/*" enabled="true" />
|
|
<add mimeType="application/javascript" enabled="true" />
|
|
<add mimeType="application/json" enabled="true" />
|
|
</dynamicTypes>
|
|
<staticTypes>
|
|
<add mimeType="text/*" enabled="true" />
|
|
<add mimeType="application/javascript" enabled="true" />
|
|
<add mimeType="application/json" enabled="true" />
|
|
<add mimeType="application/manifest+json" enabled="true" />
|
|
</staticTypes>
|
|
</httpCompression>
|
|
|
|
<!-- Default document -->
|
|
<defaultDocument>
|
|
<files>
|
|
<clear />
|
|
<add value="index.html" />
|
|
</files>
|
|
</defaultDocument>
|
|
</system.webServer>
|
|
</configuration>
|