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:
2025-12-30 16:38:47 +02:00
parent 9008876b16
commit ce85e0643b
6 changed files with 95 additions and 830 deletions

View File

@@ -465,15 +465,21 @@ function Deploy-Frontend {
Copy-Item -Path $sourceFe -Destination $Config.FrontendPath -Recurse -Force
Write-Success "Frontend files deployed"
# Copy web.config if present in package
$webConfig = Join-Path $SourcePath "config\web.config"
if (Test-Path $webConfig) {
$destConfig = Join-Path $Config.FrontendPath "web.config"
Copy-Item -Path $webConfig -Destination $destConfig -Force
Write-Success "web.config deployed"
# Verify web.config was deployed (should be in frontend/ from dist/)
$deployedWebConfig = Join-Path $Config.FrontendPath "web.config"
if (Test-Path $deployedWebConfig) {
Write-Success "web.config deployed successfully"
# Verify it has correct configuration for /roa2web/ path
$configContent = Get-Content $deployedWebConfig -Raw
if ($configContent -match 'url="[^"]*roa2web/api') {
Write-Success "web.config contains correct /roa2web/api proxy rules"
} else {
Write-Warning "web.config may not have correct /roa2web/api proxy configuration"
}
} else {
Write-Warning "web.config not found in package: $webConfig"
Write-Warning "web.config not found in deployed frontend: $deployedWebConfig"
Write-Warning "IIS reverse proxy will not work without web.config"
Write-Warning "Ensure 'public/web.config' exists in source and rebuild frontend"
}
Write-Success "Frontend deployment completed successfully"