Skip to content

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

@guardrex

Description

@guardrex

Description

Per microsoft/aspire.dev#116 (comment) ...

Wade, Javier suggests coverage for this, 🤔 probably along the lines of ...

[Default documents](#serve-default-documents) are served compressed when Default Files Middleware (<xref:Microsoft.AspNetCore.Builder.DefaultFilesExtensions.UseDefaultFiles%2A>) is placed before Routing Middleware (<xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseRouting%2A>), which allows path modification before routing takes place.

... something like that up where the caveats and gotchas are covered for MapStaticAssets. It might also be good to place the same little blurb down in the Serve default documents section in case readers go looking there when their default docs aren't being served compressed ...

Default documents are served compressed with <xref:Microsoft.AspNetCore.Builder.StaticAssetsEndpointRouteBuilderExtensions.MapStaticAssets%2A> when Default Files Middleware (<xref:Microsoft.AspNetCore.Builder.DefaultFilesExtensions.UseDefaultFiles%2A>) is placed before Routing Middleware (<xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseRouting%2A>), which allows path modification before routing takes place.

... which is again just lingo off the top of my head in the general direction of what I think he's asking for. If it isn't clear from his remarks on the PU issue, I'm sure he'll clarify further.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-10.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/static-files.md

Document ID

3fec6e08-fc99-7a5c-796f-3f2347cad891

Platform Id

5c42c2c8-be1b-60de-8cde-f9b8d8c24f5f

Article author

@wadepickett

Metadata

  • ID: d47f38e2-bc36-cfb8-b0cc-17a534689f8b
  • PlatformId: 5c42c2c8-be1b-60de-8cde-f9b8d8c24f5f
  • Service: aspnet-core
  • Sub-service: fundamentals

Related Issues


Associated WorkItem - 558585

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions