aspnetcore/breaking-changes/7/fallback-file-endpoints.md
The xref:Microsoft.AspNetCore.Mvc.ConsumesAttribute attribute allows controller actions to specify their supported content types. Starting in .NET 6, if a fallback file endpoint was configured, it could match routes that were discarded because the request had a different content type than what was specified in an action's xref:Microsoft.AspNetCore.Mvc.ConsumesAttribute. The .NET 6 behavior was an undesirable change from the .NET 5 behavior. This breaking change partially addresses the issue by making fallback file endpoints only match GET and HEAD requests.
ASP.NET Core 7.0 RC 2
Endpoints configured with xref:Microsoft.AspNetCore.Builder.StaticFilesEndpointRouteBuilderExtensions.MapFallbackToFile%2A?displayProperty=nameWithType matched requests made with any request method.
Endpoints configured with xref:Microsoft.AspNetCore.Builder.StaticFilesEndpointRouteBuilderExtensions.MapFallbackToFile%2A?displayProperty=nameWithType only match HEAD and GET requests.
This change can affect binary compatibility.
This change partially reverts a larger breaking change accidentally introduced in .NET 6. Since it's highly unusual to expect a fallback file response when making a request with a method other than HEAD or GET, the impact of this breaking change should be minimal.
If you want fallback file endpoints to match requests with methods other than HEAD or GET, you can specify additional HTTP request methods using WithMetadata(). For example:
endpoints.MapFallbackToFile("index.html")
.WithMetadata(new HttpMethodMetadata(new[] { /* List supported methods here */ }));