Roadmap › IIS — Internet Information Services and Hosting .NET Applications › Module: Hosting .NET Applications
Lessons in this course (9)
7. URL Rewrite, reverse proxy (ARR), compression and caching
IntermediateMediumLesson 7 of 9
xml
<system.webServer>
<rewrite>
<rules>
<!-- Force HTTPS -->
<rule name="HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions><add input="{HTTPS}" pattern="off" /></conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
<!-- SPA fallback: unknown paths → index.html (Angular/React hosted on IIS) -->
<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" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
<!-- Reverse proxy /node/* to a Node.js or Next.js app on port 3000 (requires ARR with proxy enabled) -->
<rule name="Proxy to Node" stopProcessing="true">
<match url="^node/(.*)" />
<action type="Rewrite" url="http://localhost:3000/{R:1}" />
</rule>
</rules>
</rewrite>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
</system.webServer>- Redirect (301/302 — browser goes to a new URL) vs Rewrite (server serves different content, URL unchanged).
- ARR (Application Request Routing): reverse proxy and load balancer — server farms with health tests, sticky sessions; lets IIS front Node.js, Next.js, Kestrel or other servers.
- Output caching / kernel caching for static and cacheable responses;
clientCachesetsCache-Controlfor static files; static and dynamic compression (gzip; Brotli via the IIS Compression module).