Overview
NuGetCDNRedirect is a deliberately thin ASP.NET MVC 5 (.NET Framework 4.7.2) web application whose sole runtime job is to redirect every incoming HTTP request to a configured CDN or canonical URL. The redirect is implemented entirely inside IIS via the<httpRedirect> configuration element in Web.config — no application code is involved in the redirect path itself. The MVC layer exists only to serve a liveness/status endpoint that infrastructure health checks can reach without being redirected.
The application was created in 2017 and has intentionally remained minimal. There is no data access, no authentication, no business logic, and no internal project references. It is deployed as a standalone Azure App Service (or IIS site).
Role in the NuGetGallery Ecosystem
CDN Traffic Shaping
Sits in front of CDN origin URLs and performs HTTP 302 redirects (IIS
Found) to route legacy or vanity hostnames to the canonical NuGet CDN endpoint.Infrastructure Health Probe
Exposes
GET /Status/Index as an exempted path (redirect disabled for that route) so load balancers and Azure health checks can confirm the app is alive.Telemetry Integration
All unhandled exceptions are forwarded to Application Insights via a global MVC filter, giving operations teams visibility into any unexpected failures.
Security Hardening
Enforces HTTPS-only cookies, removes the
X-Powered-By header, and sets a one-year HSTS header (max-age=31536000; includeSubDomains) on every response.Key Files and Classes
Dependencies
NuGet Packages
Internal Project References
NuGetCDNRedirect has no internal project references. It is a fully self-contained web application with no dependencies on NuGetGallery, NuGetGallery.Core, or any other solution project.
Notable Patterns and Implementation Details
The redirect is pure IIS configuration, not application code. The
<httpRedirect enabled="true" httpResponseStatus="Found"> block in Web.config with a <add wildcard="*" destination="https://placeholder" /> entry means every HTTP request is intercepted by the IIS Static File / Redirect module before MVC ever processes it. The destination URL is a placeholder in source control and must be overridden via a Web.config transform or deployment slot setting in production.The
/Status/Index route is explicitly exempted from redirection. A <location path="Status/Index"> block in Web.config sets <httpRedirect enabled="false" /> for that path only. This is the mechanism that allows health probes to get a real 200 OK response instead of a redirect.Startup Sequence
Status/Index which pass through normally and return 200 OK.