PozoApp.dev-optimized-and-D.../web.config

81 lines
3.4 KiB
Plaintext
Raw Permalink Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- IIS Node.js Handler -->
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" resourceType="File" />
</handlers>
<!-- URL Rewrite Rules for Clean SEO URLs -->
<rewrite>
<rules>
<!-- Rule 1: Redirect old /home/* URLs to clean URLs (SEO 301 redirect) -->
<rule name="Redirect Home Prefix" stopProcessing="true">
<match url="^home/(.*)" />
<action type="Redirect" url="/{R:1}" redirectType="Permanent" />
</rule>
<!-- Rule 2: Exclude .NET API routes from Node.js proxy -->
<rule name="Exclude API Routes" stopProcessing="true">
<match url="^api/.*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="None" />
</rule>
<!-- Rule 3: Route to server.js (Node.js proxy) for React routes -->
<rule name="NodeJS Proxy">
<match url=".*" />
<conditions>
<!-- Don't rewrite if it's a real file -->
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<!-- Don't rewrite if it's a real directory -->
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<!-- Don't rewrite API calls -->
<add input="{REQUEST_URI}" pattern="^/api/" negate="true" />
</conditions>
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
<!-- IIS Node Configuration -->
<iisnode
node_env="production"
nodeProcessCommandLine="&quot;%programfiles%\nodejs\node.exe&quot;"
interceptor="&quot;%programfiles%\iisnode\interceptor.js&quot;"
loggingEnabled="true"
debuggingEnabled="false"
/>
<!-- Security Headers for Better SEO -->
<httpProtocol>
<customHeaders>
<add name="X-Content-Type-Options" value="nosniff" />
<add name="X-Frame-Options" value="SAMEORIGIN" />
<add name="X-XSS-Protection" value="1; mode=block" />
</customHeaders>
</httpProtocol>
<!-- Static Content Caching for Performance -->
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
<mimeMap fileExtension=".webp" mimeType="image/webp" />
<mimeMap fileExtension=".woff" mimeType="font/woff" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
</staticContent>
<!-- Compression for faster loading -->
<httpCompression>
<dynamicTypes>
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/json" enabled="true" />
<add mimeType="text/css" enabled="true" />
<add mimeType="text/html" enabled="true" />
</dynamicTypes>
</httpCompression>
</system.webServer>
</configuration>