Skip to content

Commit 31a26c0

Browse files
authored
Additional Blazor static files config content (#20242)
1 parent 8a09c83 commit 31a26c0

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

aspnetcore/blazor/fundamentals/additional-scenarios.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,14 @@ To create additional file mappings with a <xref:Microsoft.AspNetCore.StaticFiles
357357
app.UseStaticFiles();
358358
```
359359

360+
* You can avoid interfering with serving `_framework/blazor.server.js` by using <xref:Microsoft.AspNetCore.Builder.MapWhenExtensions.MapWhen%2A> to execute a custom Static File Middleware:
361+
362+
```csharp
363+
app.MapWhen(ctx => !ctx.Request.Path
364+
.StartsWithSegments("_framework/blazor.server.js",
365+
subApp => subApp.UseStaticFiles(new StaticFileOptions(){ ... })));
366+
```
367+
360368
## Additional resources
361369

362370
* <xref:fundamentals/logging/index>

0 commit comments

Comments
 (0)