Skip to content

Document UseDefaultFiles ordering requirement for compressed default documents#37315

Open
wadepickett with Copilot wants to merge 4 commits into
mainfrom
copilot/cover-default-files-middleware
Open

Document UseDefaultFiles ordering requirement for compressed default documents#37315
wadepickett with Copilot wants to merge 4 commits into
mainfrom
copilot/cover-default-files-middleware

Conversation

Copilot AI commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #36469

The Static files article documents both MapStaticAssets (endpoint-based, serves build-time compressed assets) and UseDefaultFiles (a URL rewriter), but omits the ordering interaction between them: a default document is only served as a compressed static asset when the UseDefaultFiles path rewrite runs before endpoint routing matches the request — i.e., UseDefaultFiles must be called before MapStaticAssets.

Changes to aspnetcore/fundamentals/static-files.md:

  • Note near MapStaticAssets compression benefits — Explains that default documents are served compressed only when UseDefaultFiles runs before Routing Middleware, with the why (the //index.html rewrite must precede endpoint matching) and the actionable guidance (call UseDefaultFiles before MapStaticAssets). Phrased to avoid implying readers must manually add UseRouting.
  • Note in Serve default documents section — Condensed, MapStaticAssets-scoped (.NET 9+) reminder aimed at readers troubleshooting "why aren't my default docs compressed?".
  • Metadata — Updated ms.date; added ai-usage: ai-assisted under title.

Both notes are self-contained; the second is intentionally shorter to minimize duplication while remaining discoverable in context.


Internal previews

📄 File 🔗 Preview link
aspnetcore/fundamentals/static-files.md Static files in ASP.NET Core

Copilot AI changed the title [WIP] Update documentation for Default Files Middleware placement Document UseDefaultFiles ordering requirement for compressed default documents Jul 6, 2026
Copilot AI requested a review from wadepickett July 6, 2026 22:27

Map Static Assets doesn't provide features for minification or other file transformations. Minification is usually handled by custom code or [third-party tooling](xref:blazor/fundamentals/index#community-links-to-blazor-resources).

> [!NOTE]

@wadepickett wadepickett Jul 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This following note is the main point of this PR as related to the issue it fixes. Everything else changed in the PR is just some clean up per the style guide spotted along the way and fixed.

@wadepickett wadepickett marked this pull request as ready for review July 6, 2026 22:57
@wadepickett wadepickett requested a review from tdykstra July 6, 2026 23:03
@wadepickett

Copy link
Copy Markdown
Contributor

@tdykstra, could use your review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cover how to place Default Files Middleware for Map Static Assets compression

2 participants