fix: IIS sub-application deployment for production
Fixes 3 critical issues preventing production deployment on Windows IIS: 1. **IIS Sub-Application Path Stripping** - Changed URL patterns from ^roa2web/api/(.*) to ^api/(.*) - IIS sub-app at /roa2web automatically strips prefix - Requests arrive as /api/* not /roa2web/api/* 2. **SPA Fallback Absolute Path** - Changed from url="/index.html" to url="index.html" - Absolute paths (/) refer to site root, not sub-app - Relative path correctly serves from sub-app 3. **MIME Type Duplicates (500 Error)** - Added <remove> before <mimeMap> for .js, .json, .webmanifest - Prevents "duplicate collection entry" errors - Allows override of server-level MIME types Build Script Improvements: - Build-ROA2WEB.ps1: Copy public/ folder to temp build dir - Build-ROA2WEB.ps1: Added verification logging for web.config - ROA2WEB-Console.ps1: Fixed web.config verification location Cleanup: - Removed outdated web.config.10.0.20.36-INTERNAL - Removed temporary test files and docs Tested: https://roa2web.romfast.ro/roa2web/ - login page loads successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,26 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
====================================================================
|
||||
ROA2WEB - Internal Application Server Configuration
|
||||
ROA2WEB - IIS Sub-Application Configuration
|
||||
====================================================================
|
||||
|
||||
⚠️ IMPORTANT - READ BEFORE DEPLOYMENT! ⚠️
|
||||
⚠️ CRITICAL - For IIS Sub-Application Deployment! ⚠️
|
||||
|
||||
This web.config is for the INTERNAL application server (10.0.20.36)
|
||||
This web.config is for when IIS is configured as SUB-APPLICATION:
|
||||
- IIS Application Path: /roa2web
|
||||
- Physical Path: C:\inetpub\wwwroot\roa2web\frontend (or dist/)
|
||||
|
||||
**How IIS Sub-Applications Work**:
|
||||
- Browser request: https://example.com/roa2web/api/auth/login
|
||||
- IIS application PATH strips the "/roa2web" prefix
|
||||
- Inside application: request arrives as /api/auth/login
|
||||
- Therefore: URL patterns must NOT include "roa2web/" prefix!
|
||||
|
||||
**Production Architecture (2-Tier IIS)**:
|
||||
|
||||
Public Server (10.0.20.122) → uses different web.config!
|
||||
└─ Proxies to Internal Server (10.0.20.36) → uses THIS web.config
|
||||
└─ Proxies to Backend (localhost:8000)
|
||||
Public Server (10.0.20.122 - roa2web.romfast.ro)
|
||||
└─ Proxies ALL to → https://10.0.20.36/{REQUEST_PATH}
|
||||
|
||||
Internal Server (10.0.20.36)
|
||||
└─ IIS Sub-App: /roa2web → Physical: C:\inetpub\wwwroot\roa2web\frontend
|
||||
└─ This web.config proxies /api/* to localhost:8000
|
||||
|
||||
See: deployment/windows/docs/TWO-TIER-IIS-DEPLOYMENT.md
|
||||
|
||||
**Deployment**:
|
||||
- This file is built into dist/ by Vite
|
||||
- Copy to: C:\inetpub\wwwroot\roa2web\web.config (on 10.0.20.36)
|
||||
- For public server config, see: deployment/windows/config/web.config.10.0.20.122-PUBLIC
|
||||
|
||||
====================================================================
|
||||
-->
|
||||
<configuration>
|
||||
@@ -28,33 +34,38 @@
|
||||
<rewrite>
|
||||
<rules>
|
||||
<!-- Proxy API requests to unified backend on localhost -->
|
||||
<!-- NOTE: NO /roa2web/ prefix - IIS sub-app already stripped it! -->
|
||||
<rule name="Proxy Unified API" stopProcessing="true">
|
||||
<match url="^roa2web/api/(.*)" />
|
||||
<match url="^api/(.*)" />
|
||||
<action type="Rewrite" url="http://localhost:8000/api/{R:1}" />
|
||||
</rule>
|
||||
|
||||
<!-- Proxy uploads to unified backend on localhost -->
|
||||
<rule name="Proxy Uploads" stopProcessing="true">
|
||||
<match url="^roa2web/uploads/(.*)" />
|
||||
<match url="^uploads/(.*)" />
|
||||
<action type="Rewrite" url="http://localhost:8000/uploads/{R:1}" />
|
||||
</rule>
|
||||
|
||||
<!-- SPA fallback - all other routes serve index.html -->
|
||||
<rule name="SPA Fallback" stopProcessing="true">
|
||||
<match url="^roa2web/.*" />
|
||||
<match url=".*" />
|
||||
<conditions logicalGrouping="MatchAll">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="/roa2web/index.html" />
|
||||
<action type="Rewrite" url="index.html" />
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
|
||||
<!-- Static content configuration -->
|
||||
<staticContent>
|
||||
<!-- Remove first to avoid duplicates with server-level config, then add -->
|
||||
<remove fileExtension=".webmanifest" />
|
||||
<mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
|
||||
<remove fileExtension=".js" />
|
||||
<mimeMap fileExtension=".js" mimeType="application/javascript" />
|
||||
<remove fileExtension=".json" />
|
||||
<mimeMap fileExtension=".json" mimeType="application/json" />
|
||||
</staticContent>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user