77 lines
3.2 KiB
XML
77 lines
3.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<configuration>
|
|
<system.webServer>
|
|
<!-- Remove WebDAV module AND handler: WebDAV intercepts PUT/DELETE causing 405
|
|
The MODULE (not just handler) must be removed, otherwise WebDAV intercepts
|
|
PUT/DELETE at the module stage before URL Rewrite can proxy the request -->
|
|
<modules>
|
|
<remove name="WebDAVModule" />
|
|
</modules>
|
|
<handlers>
|
|
<remove name="WebDAV" />
|
|
</handlers>
|
|
|
|
<!-- Allow large uploads (2GB) + all HTTP verbs (PUT/DELETE) -->
|
|
<security>
|
|
<requestFiltering>
|
|
<verbs allowUnlisted="true" />
|
|
<requestLimits maxAllowedContentLength="2147483648" />
|
|
</requestFiltering>
|
|
</security>
|
|
|
|
<!-- Reverse proxy rules + SPA fallback
|
|
NOTE: ARR proxy must be enabled at SERVER level (one-time):
|
|
Set-WebConfigurationProperty -Filter system.webServer/proxy -name enabled -value true -PSPath 'IIS:\'
|
|
Do NOT put <proxy enabled="true" /> here - it causes 0x8007000d when server-level proxy is off -->
|
|
<rewrite>
|
|
<rules>
|
|
<!-- Proxy API requests to backend Kestrel on port 30001 -->
|
|
<rule name="API Proxy" stopProcessing="true">
|
|
<match url="^api/(.*)" />
|
|
<action type="Rewrite" url="http://localhost:30001/api/{R:1}" />
|
|
</rule>
|
|
<!-- Proxy /uploads/ to backend (Local storage mode serves files via backend) -->
|
|
<rule name="Uploads Proxy" stopProcessing="true">
|
|
<match url="^uploads/(.*)" />
|
|
<action type="Rewrite" url="http://localhost:30001/uploads/{R:1}" />
|
|
</rule>
|
|
<!-- Block /backups/ direct access: DB backups only via authenticated API -->
|
|
<rule name="Block Backups" stopProcessing="true">
|
|
<match url="^backups/(.*)" />
|
|
<action type="CustomResponse" statusCode="404" statusReason="Not Found" />
|
|
</rule>
|
|
<!-- SPA fallback: non-file, non-directory requests go to index.html -->
|
|
<rule name="SPA Fallback" 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="{REQUEST_URI}" pattern="^/api/" negate="true" />
|
|
<add input="{REQUEST_URI}" pattern="^/uploads/" negate="true" />
|
|
</conditions>
|
|
<action type="Rewrite" url="index.html" />
|
|
</rule>
|
|
</rules>
|
|
</rewrite>
|
|
|
|
<!-- Static content MIME types (including Unity WebGL .unityweb) -->
|
|
<staticContent>
|
|
<remove fileExtension=".woff" />
|
|
<remove fileExtension=".woff2" />
|
|
<remove fileExtension=".mjs" />
|
|
<remove fileExtension=".unityweb" />
|
|
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
|
|
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
|
|
<mimeMap fileExtension=".mjs" mimeType="application/javascript" />
|
|
<mimeMap fileExtension=".unityweb" mimeType="application/octet-stream" />
|
|
</staticContent>
|
|
|
|
<defaultDocument>
|
|
<files>
|
|
<clear />
|
|
<add value="index.html" />
|
|
</files>
|
|
</defaultDocument>
|
|
</system.webServer>
|
|
</configuration>
|