Middleware Pipeline
The application centralizes standard middleware ordering through UseApplicationPipeline() so Program.cs remains focused on application startup and service registration.
The pipeline order is:
- Forwarded headers
- Structured request logging
- Centralized error handling
- Problem Details handling
- Security headers
- HTTPS redirection
- Static files
- Routing
- CORS
- Rate limiting
- Authentication
- Authorization
- Controller and Razor Page endpoint mapping
This order keeps proxy correction early, request logging close to the beginning of the request, error handling ahead of most application behavior, and endpoint-specific features such as CORS and rate limiting after routing.